Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to detect if player is idle?

Asked by 4 years ago

I've looked through Google and the DevForums, but I can't seem to find anything that works, here is what I have so far.

local running
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
humanoid.Running:connect(function(speed) -- return value; speed of the running
if speed > 0 then running = true
    script.Parent:WaitForChild("1"):TweenPosition(UDim2.new(0.5, 0, 0.545, 0), "Out", "Linear", 0.3, false)
    script.Parent:WaitForChild("2"):TweenPosition(UDim2.new(0.5, 0, 0.465, 0), "Out", "Linear", 0.3, false)
    script.Parent:WaitForChild("3"):TweenPosition(UDim2.new(0.49, 0, 0.505, 0), "Out", "Linear", 0.3, false)
    script.Parent:WaitForChild("4"):TweenPosition(UDim2.new(0.51, 0, 0.505, 0), "Out", "Linear", 0.3, false)
    print(speed)
    end
end)

Basically, it's a dynamic crosshair. I have got this to work with loops, but they prevent seperate edits to the crosshair as it is constantly tweening it. Thanks in advance.

(also I didnt write that code apart from the tweening part, I'm bad with this kind of stuff)

0
Can you rephrase the question? What exactly does your script do right now, and what do you want it to be able to do? IStarConquestI 414 — 4y
0
There is a event of Player called Player.Idled https://developer.roblox.com/api-reference/event/Player/Idled Block_manvn 395 — 4y
0
you detect if a player is idle when their walk speed is 0. Fxding_cam 60 — 4y

Answer this question