Hello, I need help with something I’m making a speed simulator where the player gain points by running, is there a better way to know if a player is running because the script I use lags the player and not good for example like when I ran into a wall while still holding “W” the event still fires. Is there a better way to do this? I tried looking for solutions in the DevForum but none of them helped.
local player = game:GetService("Players").localPlayer
local remotes = game:GetService("ReplicatedStorage")
while wait(0.5) do
if player.Character:FindFirstChildWhichIsA("Humanoid").MoveDirection.Magnitude > 0.1 then
remotes.AddPoints:FireServer()
end
end
This doesn’t work because when you get the signal for CFrame or Position, the signal is only fired when a script edits the value and not when physics updates it.
So if you try this, you will see that the signal is never fired.