[im noob] can anyone help? script should play as soon as humanoid stops moving (if possible then at a given time of not moving)

A game file so we can actually see where the humanoid and other things are located without you having to explain it. You don’t have to if it has parts of your game that you don’t want to show.

1 Like

only can build the script when playing, ima send you the game file right away just dont reupload it lol

1 Like

No, don’t send it to me
My studio isn’t working like I said before.

2 Likes

i’ll try this

debounce = false
	script.Parent.Equipped:Connect(function(Mouse)
	game.Workspace.Player.Humanoid.Running:Connect(function(speed)
    
		if script.parent.Parent.Humanoid.WalkSpeed > 0 then
        	print("Player is running")
    	else

    		wait(8)
        		if debounce == false then
            		debounce = true			
            		animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Idle)
            		animation:Play()
            		wait(1.5)
            		debounce = false
					print('Speer Operator is now Idle!')
        		end
    		end

		script.Parent.Unequipped:Connect(function()
        	animation:Stop()
			print('Speer Unequipped, animation stopped!')
		end)

    	end)
	end)






1 Like

well now the output is " 08:41:19.040 - Player is not a valid member of Workspace"
the error is at

debounce = false
	script.Parent.Equipped:Connect(function(Mouse)
	game.Workspace.Player.Humanoid.Running:Connect(function(speed)
1 Like

Is it your avatar or a rig? If it is your avatar, then replace player with your players name. You can change this to be the player who is holding the spear later.

1 Like

its a tool that should play animation when a player is idle for an exceeding time
ima try to just remove the " game.Workspace.Player.Humanoid.Running:Connect(function(speed)" as it was part of the method i used before

1 Like

Try just removing “Player” and do your username. Not the whole thing.

1 Like

well but then it would only be detecting me right, and it was part of the older method, is it still worth existing?

1 Like

I am assuming that your script is a local script?

1 Like

removed it, but now it only reaches print(‘player is running!’) it wont go further when i stop
oh and yes its local

1 Like

oof, it thinks im running as soon as i equip it

1 Like

Is it continuously running as soon as you run and equip, or is it a one-off?

1 Like

noo, the script prints “Player is running” just when i equip it, even tho im standing completely still (when equipping it the speer touches the ground for 1s causing the player to bounce a tiny bit)
but even then it is never printing that it stoppped moving

1 Like

Try a while true statement and add a wait() at the end of the while loop. While around the whole script.

1 Like

hmmmmm, and how exactly do i build that up?
like (not a correct script form, just how its going to be built up):

if speed >0 (under 0) then 
wait(8)
        		if debounce == false then
            		debounce = true			
            		animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Idle)
            		animation:Play()
            		wait(1.5)
            		debounce = false
					print('Speer Operator is now Idle!')
        		end
    		end
while true do 	print("Player is running")
1 Like

Above the debounce on this post.

Do “while true do” above, don’t forget the “end” (no brackets after end!)

2 Likes
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

hum.Running:Connect(function(speed)

   if speed == 0 then
      -- Code
   end

end)
2 Likes

oh! thank you alot, i’ll check it out, and where do i input the thing with it stopping etc?

1 Like

It was == 0 like above. Sorry! > is for bigger

2 Likes