How do you make a detector for movement? I've been trying various methods, anyone have some pointers? Just a basic movement detector.
COMMUNITY QUESTION
Can you make a movement detector?
2 answers
humanoid.Running:Connect(function(speed)
if speed >0 then
print('running')
end
end)
Assuming you mean movement for players, you can use the StateChanged event of Humanoids.This works in either a local or a server script, but I'll show an example on the server-side:
game:GetService("Players").PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
humanoid.StateChanged:Connect(function(old,new)
if new == Enum.HumanoidStateType.Running then
print("Movement begun")
end
end
end)
2 comments
1
isn't that the same script i basically did lol
0
shhh no one has to know
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
this will fire whenever the speed changes, so if the walkspeed is altered it will cause the print to run
you could also use magnitude
Doesn't work, how does it even detect the humanoid? I'm using a hit detect but it's not working.