Roblox generously provides a code to detect whether a player moves or not:
game.Workspace.Player.Humanoid.Running:Connect(function(speed) if speed > 0 then print("Player is running") else print("Player has stopped") end end)
but the problem with this is that the script sometimes misfires, meaning the when the script prints "Player is running", it would fire 3 times or so before stopping, and the same would be when the player stops.
Is there an accurate way to outright detect whether the player began moving or completely stop. I preferably would not like to use key pressing events as I would like this to work on Console where they use thumbsticks.
I don't know if this is more accurate or not, but it is a different way of doing this. I'm also going to assume you have placed this script inside character scripts.
if script.Parent.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then --do stuff end
So you would place this inside character scripts as a local script, and it definitely is a simpler solution than roblox's function there.
Edit: If you have this inside of RenderStepped, it will be more accurate because it will be checking every tick for movement.
game:GetService("RunService").RenderStepped:Connect(function() if script.Parent.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then print(script.Parent.Humanoid.MoveDirection) end end)
So I don't know how you'll like this solution, but it should work for your purpose
local previous = Vector3.new(0,0,0) while true do if game.Workspace.Player.HumanoidRootPart.Position~=previous then print("Player is running") previous = game.Workspace.Player.HumanoidRootPart.Position else print("Player has stopped") previous = game.Workspace.Player.HumanoidRootPart.Position end end