So I was playing one of those speed city games and I though I could probably make one of those so I tried to make a moving detection script cause thats pretty much the entire game lol but I cant get mine to work, I know there are plenty of easier ways to make one compared to mine but I dont understand them that well (Basically I would need a really in depth explanation) , but here's mine I also placed the script in the StarterCharacterScripts
local moving = false -- Moving Variable
function movingdetection() -- Function for detecting when player is moving
if script.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0) then -- Checking if they are moving in any direction
local moving = false
else
local moving = true
end
end
while true do -- Loop for constantly calling the moving detection function
print("ok then")
movingdetection() -- Calling the function
if moving == true then -- Seeing if the player moving comes back true
print("moving") -- To show that its working
end
wait(0.5)
end
