So, like many video games/Sonic games when the player won't touch any key/mouse won't move at all the character does a ''wait for idle'' and stuff showing that he is bored and wants the player to continue playing. So I made a script that when u wait(3) it plays an animation a sound and some particles but my script doesn't work how to fix it? ps: I'm not a professional go easy on me: and its a local script in char script with the sound and the anim (the particle is in my character's head):
"while true do local player = game.Players.LocalPlayer local character = workspace:WaitForChild(player.Name) local humanoid = character:WaitForChild("Humanoid") local waiting = script:WaitForChild(("waitanimation")) local yawn = script:WaitForChild(("waning"))
wait (3) if humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics then waiting:Play() yawn:Play() game.LocalPlayer.Character.Head.sleepingparticle.Enabled = true wait(0.9) waiting:Stop() yawn:Stop() game.LocalPlayer.Character.Head.sleepingparticle.Enabled = false
if humanoid:GetState() == Enum.HumanoidStateType.Swimming and humanoid:GetState() == Enum.HumanoidStateType.Freefall and humanoid:GetState() == Enum.HumanoidStateType.Dead and humanoid:GetState() == Enum.HumanoidStateType.Running and humanoid:GetState() == Enum.HumanoidStateType.Jumping then waiting:Stop() yawn:Stop() game.LocalPlayer.Character.Head.sleepingparticle.Enabled = false
wait(2)
end script.Disabled = false end end"