local hum = findFirstChild("Humanoid") hum.Walkspeed = 0
When I use this script, players can still move. Can someone help?
I got this is output
Workspace.Map_Changer:88: attempt to call global 'FindFirstChild' (a nil value)
First off, I take it this is located within a local script of a player. If so, you will want it to wait until it finds the the player.
Here, try this script..
repeat wait() until game.Players.LocalPlayer local player = game.Players.LocalPlayer local hum = player.Character.Humanoid if hum.WalkSpeed == 16 then hum.WalkSpeed = 0 end
This should work.
Edit:
After looking at what you said for the error, it looks like it's not in a local script for the player.
What you will want to do is define the player then define the humanoid like I did at top. It won't be hard to edit.
wait(.1) P = game.Players.LocalPlayer H - P.Character:FindFirstChild("Humanoid") if H then H.WalkSpeed = 0 elseif H.WalkSpeed == 0 then H.WalkSpeed = 16 end
Hope I helped!
You didn't set it to find where the Humanoid is, the script is thinking Where do I find the Object named Humanoid? Is it in workspace, script.Parent, or where?!
, thus the script didn't work. Heres what you'd do;
Figure=script.Parent:FindFirstChild("Humanoid") --This would be in the Character if Figure~=nil then Figure.WalkSpeed=0 end
I hope this helped!
You should probably explain the answer to him, to help him learn. The error is saying you aren't connecting the FindFirstChild() method to anything, thus it is nil.
To do this, you must first define humanoid. This would run in a LocalScript in StarterPack.
plr = game.Players.LocalPlayer; h = plr:FindFirstChild("Humanoid", true);
Now, we'll reference those objects and set the walkspeed :
if h then h.WalkSpeed = 0; end
Hope this helped.