How to FREEZE Character Movement in ROBLOX STUDIO (EASY)

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 58

  • @scripting
    @scripting  Рік тому +2

    Hello everyone! I hope you enjoyed this video! I released a Patreon for those that want to support me (with lots of benefits including scripting support!)
    www.patreon.com/PremiumScripters

  • @viyro1
    @viyro1 7 днів тому

    the lofi still with you is nice

  • @JustATortoise
    @JustATortoise Рік тому +4

    The ContextActionService way only freezes controls on pc, not on mobile or console.

    • @scripting
      @scripting  Рік тому +2

      Ah, sorry about that. Use the other 2

  • @Terry-ro3yx
    @Terry-ro3yx Рік тому +2

    Hey, How do you make your character pause for a second by using a letter such as "E"?

  • @OnlineyLiney
    @OnlineyLiney Місяць тому

    I'm looking to make the script activate when a part is touched,and deactivate it when the part isn't touched anymore.

  • @Preston_Games
    @Preston_Games Рік тому +2

    what ever happened to your brick bronze game and discord server

  • @IgoByHood
    @IgoByHood Рік тому +2

    I'm trying to make it freeze because the starting animation for the game and cutscene, the player is still able to move in. but the catch is the spawn on the island has a part and once the player touches the part it'll play the animation but i need to freeze it so it doesnt just start

    • @scripting
      @scripting  Рік тому +1

      The video teaches you how to freeze the player so they don’t move. You can incorporate it into your game by placing the line(s) of code wherever you want it to freeze

    • @IgoByHood
      @IgoByHood Рік тому +1

      @@scripting okay thanks i got it, but i am trying to make it freeze for 15 seconds before unfreezing so i put wait(15) before the line that unfreezes but its always unfreezing at 5 seconds... idk why that is. Can u help possibly?

    • @scripting
      @scripting  Рік тому +1

      Check the output for errors@@IgoByHood

  • @AbobaValerkin
    @AbobaValerkin День тому

    Thanks a lot!!!

  • @ambrosesimps4waifu622
    @ambrosesimps4waifu622 9 місяців тому

    How do I make it so that if I hold E on a block it stop my character completely?

  • @scripting
    @scripting  Рік тому +2

    Here's the code from #3:
    local ContextActionService = game:GetService('ContextActionService')
    ContextActionService:BindAction(
    "FreezeMovement",
    function() return Enum.ContextActionResult.Sink end,
    false,
    unpack(Enum.PlayerActions:GetEnumItems())
    )

    • @ate9d
      @ate9d Рік тому +1

      You can also disable the controls from the PlayerModule in PlayerScripts like this:
      local Player = game:GetService("Players").LocalPlayer
      local PlayerModule = require(Player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls()
      PlayerModule:Disable()

    • @scripting
      @scripting  Рік тому

      @ate9d absolutely correct. It was not covered in this video but is correct nevertheless- thank you!

  • @Ny5n
    @Ny5n 6 місяців тому

    how i can freeze a npc like my avatar bc its keep falling

  • @Pyrolectric
    @Pyrolectric Рік тому

    how do you make it so you can freeze a certain team?

    • @Blue-tq3uj
      @Blue-tq3uj Рік тому

      get a table of the players in the team, make a for loop which goes through each player and anchors their humrp or whichever method of freezing you prefer.

  • @Ignition823
    @Ignition823 11 місяців тому +2

    Hi, love your vids but quick question!
    How do you unfreeze the player if you used the last script?

    • @nomadrblx8659
      @nomadrblx8659 10 місяців тому

      copy and paste, but instead of walkspeed = 0 do it at 16 or whatever speed u want

    • @Ignition823
      @Ignition823 10 місяців тому

      ive leared scripting over the last month and thats not how you do it
      @@nomadrblx8659

    • @Ignition823
      @Ignition823 4 місяці тому

      @@nomadrblx8659 no i mean the LAST script with the binding and allat

    • @ibaadnstuff
      @ibaadnstuff 4 місяці тому

      @@Ignition823 i believe you need to change false to true

  • @Syher_BloxFruits
    @Syher_BloxFruits Рік тому

    so i have a gui for my game that says play and that has a script so how do i add it in without breaking the original script?

    • @scripting
      @scripting  Рік тому

      You can just put the code from this video wherever you want the player to be frozen

    • @Syher_BloxFruits
      @Syher_BloxFruits Рік тому

      I want to code it so that when I press play it disables the freeze

    • @Syher_BloxFruits
      @Syher_BloxFruits Рік тому

      @@scripting ?

    • @scripting
      @scripting  Рік тому

      @Syher_BloxFruits my recommendation is that you watch through this playlist
      Beginner's Guide to Roblox Scripting Tutorials
      ua-cam.com/play/PL8fZVwiyGscD354QCCczm1D5v0hCnA8-r.html
      It will give you a basic coding foundation.
      If your button is inside of a ScreenGui inside of StarterGui, you can do something like this:
      game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton.MouseButton1Click:Connect(function()
      game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true
      end)

  • @aquajuggernaut
    @aquajuggernaut Рік тому

    How do i do this if i click a part?

    • @scripting
      @scripting  Рік тому

      You’d have to bind it to a ClickDetector

  • @Llight52
    @Llight52 Рік тому

    How do i make it so every player freezes

    • @scripting
      @scripting  Рік тому +1

      You can use
      for i, player in pairs(game.Players:GetPlayers() do
      - - put the freeze code here
      end

    • @Llight52
      @Llight52 Рік тому

      @@scripting thanks bro

    • @Mr.Sfoozs
      @Mr.Sfoozs Рік тому

      what does the for i,player in pairs do?@@scripting

    • @scripting
      @scripting  Рік тому

      @Mr.Sfoozs Hi! The “for i, player in pairs” loops through every player. The “player” refers to the current player that it’s on during the loop.
      So let’s say player1 and player2 were in the game. The loop will cycle through both players and the variable “player” will refer to the current player that it’s on. So the first time, “player” refers to player1, and the second time it refers to “player2”

  • @BarbzCmon
    @BarbzCmon 6 місяців тому

    Can u pls make a vid how to stop a killer(from toolbox) stop moving if u look at it

  • @Matetheemperorofhell
    @Matetheemperorofhell Рік тому

    So, I have a game when player goes through part a jumpscare will appear, and i need the player to stop moving and camera to freeze at certain position. I tried to freeze player by your script but it isnt working. What should I do? Please help

    • @scripting
      @scripting  Рік тому

      The code from this video should work. Try using the humanoid root part . Anchored = true

    • @Matetheemperorofhell
      @Matetheemperorofhell Рік тому

      @@scripting I tried puttung the code together with my "on touch" code, but it doesnt wotk. It looks like this:
      local player = game.Players.LocalPlayer
      local char = player.Character
      local hrp = char.HumanoidRootPart
      local FreezePart = script.Parent
      local function onPartTouched(otherPart)
      local partParent = otherPart.Parent
      local humanoid = partParent:FindFirstChild("Humanoid")
      if humanoid then
      hrp.Anchored = true
      end
      end
      FreezePart.Touched:Connect(onPartTouched)
      Please help. Again...

    • @scripting
      @scripting  Рік тому

      @Matetheemperorofhell you want your hrp to be right after that “if humanoid” line
      You want local hrp = partParent.HumanoidRootPart

  • @ducbruh
    @ducbruh Рік тому

    it does not work

    • @scripting
      @scripting  Рік тому

      It should

    • @ducbruh
      @ducbruh Рік тому

      @@scripting i dont find humanoid root part

    • @ducbruh
      @ducbruh Рік тому

      and it says attempet to index nil with Character

    • @scripting
      @scripting  Рік тому

      Can I see your code?

    • @ducbruh
      @ducbruh Рік тому

      @@scripting local player = game.Players.LocalPlayer
      local char = player.Character
      local hrp = char.HumanoidRootPart
      local storage = game.ReplicatedStorage
      hrp.Anchored = true

  • @ia02929
    @ia02929 Рік тому

    Basically how do I make it where like the player freezes for a certain duration, unfreezes after a certain duration and has a cooldown when the part can be touched again?

    • @scripting
      @scripting  Рік тому

      Hi! You can use the task.wait function to achieve this.
      So, freeze the player.
      task.wait(2)
      Unfreeze the player
      The task.wait(2) waits 2 seconds.
      To implement a cooldown, you’ll need to learn about Boolean variables. Check my variables tutorial on that. You’ll also need if statements (something called denounce).