Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there's a way to determine if player is on idle?

Basically, my scenario is: Right when players spawn they get an instant forcefield and it should always be there as long as the player doesn't move. I want to check if the player is not idle anymore to remove the forcefield.

delay(0, function()
    for _, Player in next, Players:GetPlayers() do
        local Character = Player.Character or Player.CharacterAdded:wait()
        Player.Idled:wait()
        if Character:FindFirstChild('ForceField') then
            Character.Forcefield:Remove()
        end
    end
end)

My attempt doesn't work

2 comments

0

Make sure it was a LocalScript.

0

maybe you can use a if statement that checks the player x or z position

2 answers

I think you mean something like this:

game.Players.LocalPlayer.Idled:Connect(function()
	print("you idled.")
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.