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

O_O what is it and which msg??

1 Like

Instead of using > use == on the speed if statement. You would use > if you were moving.

2 Likes

you want it to play animation after 8 seconds of holding a tool and not moving right?

2 Likes

ye boi, i was about to ask, how do i write that condition?

1 Like

give me one second, I’m going to script that

2 Likes

is the animation set to Loop? .

2 Likes

nope, not yet, let me just make it looped real quick

1 Like

in case you don’t know you need to do that in the animation editor

2 Likes

ye i maed the animation myself, thanks anyway!

1 Like

ok i looped the animation, wat now?

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

local tool = script.Parent
local idleAnimation = ...

local isIdle = false
local isToolEquipped = false

-------------------------------------

local function playIdle()
	
	if isIdle == true and isToolEquipped == true then

                print("Idle will start in 8 seconds!")

		wait(8)

		local idleAnimTrack = hum:LoadAnimation(idleAnimation)
		idleAnimTrack:Play()
		
	end
	
end

hum.Running:Connect(function(speed)

	if speed == 0 then
		
		isIdle = true
		
		playIdle()
		
	else
		
		isIdle = false
		
		for i, v in pairs(hum:GetPlayingAnimationTracks()) do
			
			v:Stop()
			
		end
		
	end

end)

tool.Equipped:Connect(function()
	
	isToolEquipped = true
	
	playIdle()
	
end)

tool.Unequipped:Connect(function()
	
	isToolEquipped = false
	
	for i, v in pairs(hum:GetPlayingAnimationTracks()) do
		
		v:Stop()
		
	end
	
end)

Try this, didn’t test so I can’t say it’ll work

1 Like

Don’t forget to fix the animation object path by the way

1 Like

let me fix one thing (30 chars)

oh you mean script.parent.Idle

I did a small fix to the script, when you stop running and you’re holding the tool, it should print “Idle will start in 8 seconds!”

1 Like

ok, it sseems like most of it is working already, let me just input it and i will inform you

1 Like

yo check this out O_O (happened after qeuipping 1x)oof

hummmmmmmmmmmmmmmmmmlet me see

uhhhhhhhhhhhhhh when unequipping the tool, it just plays the default run animation even tho im not moving lol

imma create an animation and a tool and test it in my game, I’ll hit you up when I fix it (if I do lol)

1 Like