How can i detect if they player is walking and give him points for it every 0.5 seconds?

Hello , i’ve recently been trying to make a system which gives the player x amount of points every 0.5 seconds if he is walking.
I know about the “Walking” event but it just doesn’t work as expected , it is working even if the player is not doing anything (not walking). I did some research but i couldn’t find any solution for my problem. Any help would be appreciated!

3 Likes

You could potentially log the players position every x seconds and then check for a difference in position.

6 Likes

Check the humanoid move to point or walk to point every X seconds. If it’s not Vector3.new(0,0,0) then they’re moving.

15 Likes

You can also check if their walk to or move to magnitude is > 0.

5 Likes

Alternatively you could you the Humanoid.Running Event and get it’s return value to figure out if the player is walking

so

local running --bool to determine if player is running

humanoid.Running:connect(function(speed) -- return value; speed of the running
if > 0 then running = true
elseif speed < 1 then
running = false
end
end)
16 Likes

Sorry for reviving, but I want to make a correction for anyone who copies from this topic.

couple of changes once I edited - fixed my bad grammar and added some Luau syntax.

local running --bool to determine if player is running

humanoid.Running:connect(function(speed) -- return value; speed of the running
if > 0 then running = true
elseif speed < 1 then
running = false
end
end)

to

local running: boolean --bool to determine if player is running

humanoid.Running:Connect(function(speed: number) -- return value; speed of the running
    running = if speed > 0 then true else false --new change, now using Luau syntax

     if running then
         --your code if running is true
     else
         --your code if running is false
     end
end)
5 Likes