So earlier i asked how i could make the character stop while throwing a fireball. So i tried to anchor the torso like this, but it doesn't seem to work. Any help would be appreciated.
local Player = game.Players.LocalPlayer local torso = Player.Character:FindFirstChild("Torso") local Mouse = Player:GetMouse() local RemoteEvent = game.Workspace.Fired local UIS = game:GetService("UserInputService") local Debounce = false UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.R then if Debounce == true then return end torso.Anchored = true wait (0.5) torso.Anchored = false RemoteEvent:FireServer(Debounce) end end)
Hello, hh9man.
Possible reasons for your problem:
You are running the game at r15, in which the Player's Character have different body parts--Torso which is divided into UpperTorso and LowerTorso,
If you are running at r15, I suggest changing the anchor part to the whole character's body:
for i = 1, #parts do if (parts[i].ClassName == "MeshPart") then parts[i].Anchored = true end end --Feel free to use this to replace line 12 in your script and just change Anchored = false in line 14
local humanoid = Player.Character:WaitForChild("Humanoid") -- use WaitForChild as it properly waits until it loads, some script loads faster causing it to run first even without the object thereby causing it to break. local walkspeed = humanoid.WalkSpeed --The reason for using a -100 and +100 is because your game might have people using different walkspeed, some are faster and some are slower. walkspeed = walkspeed - 100 -- this turns their walkspeed into negative so it prevents them from moving walkspeed = walkspeed + 100-- this turns their walkspeed back to positive, back to their old walkspeed.