I've been experimenting lately, and I can't figure out a function(s) that fires when player moves. I've tried using the Changed, and ChangedState functions, neither of which have worked for me. If there is a way to use these, or if there's another way then please help me out.
This is an example of something I've tried:
Player=game.Players.LocalPlayer ---Yes I know this requires a LocalScript--- Player.Character.Torso.Changed:connect(function(Property) if Property="Position" then print("Yay") end end)
Anyways, if anyone could help me out, thanks in advance :P
You can use the Running
event inside Player.Character.Humanoid
. This is fired when the player begins or ends moving.
Example:
Player = game.Players.LocalPlayer repeat wait() until Player.Character -- This waits for the character to spawn in Player.Character:WaitForChild("Humanoid").Running:connect(speed) --You have to include the 'speed' parameter to check if they are starting to run rather than stopping if speed > 0 then print("Player has begun to run!") else print("Player has stopped running!") end end)