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

Idled Player script help please?[STILL UNANSWERED]

I got this script from the wiki but it takes 2 minutes for the function to run, How could you make the time change to 5 seconds or so?

game.Players.Player.Idled:connect(function(time)
     print("Player has been idle for " .. time .. " seconds")
end)

1 answer

Maybe try getting it when they're walk speed hits 0 then keep adding time to a variable called idleTime. Maybe try this:

idleTime = 0

character = game.Players.Player.Character
character.Humanoid.WalkSpeed.Changed:connect(function ()
	if character.Humanoid.WalkSpeed == 0 then
		while character.Humanoid.WalkSpeed == 0 do
			wait(1)
			idleTime = idleTime + 1
			print("Player has been idle for "..idleTime.." seconds")
		end
	end
end)

2 comments

1

That isn't going to work if the character walkspeed is always 16.

0

Oh woops I believe there is a way to tell when the player is and isn't walking though

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