Animation not playing

This is a local script inside a tool, it prints everything out but I can’t see the animation, and there’s no errors.

local state = script.Parent:WaitForChild("State")
local idleanim = script.Parent:WaitForChild("BodyAttach"):WaitForChild("Idle")
local plr = script.Parent.Parent.Parent

state:GetPropertyChangedSignal("Value"):Connect(function()
	print("property change")
	local char = plr.Character
	local hum = char:WaitForChild("Humanoid")
	local idletrack = hum.Animator:LoadAnimation(idleanim)

	if state.Value == "Idle" then
		print("playin")
		idletrack:Play()
	else
		idletrack:Stop()
	end
end)

If it’s a local script, you don’t need this. All you need is:

local plr = game.Players.LocalPlayer

And why is it inside of a tool? Put it in StarterGUI or StarterPlayerScripts

1 Like

yeah i already tried using localplayer, makes no difference

this script loads the animations of the specific tool its in

bump, i need an answer as soon as possible

I think you can try this script

local state = script.Parent:WaitForChild("State")
local idleanim = script.Parent:WaitForChild("BodyAttach"):WaitForChild("Idle")
local plr = script.Parent.Parent.Parent

local char = plr:WaitForChild("Character")
local hum = char:WaitForChild("Humanoid")
local idletrack = hum.Animator:LoadAnimation(idleanim)

state:GetPropertyChangedSignal("Value"):Connect(function()
    print("property change")

    if state.Value == "Idle" then
        print("playing")
        if not idletrack.IsPlaying then
            idletrack:Play()
        end
    else
        if idletrack.IsPlaying then
            idletrack:Stop()
        end
    end
end)

it prints everything out but i still dont see the animation, and there are no errors

Is the animation ID correct, and valid?

yes: rbxassetid://118705353095554

Is the animation R6 or R15 Animation? Because R6 Does not work in R15

It’s a custom rig, not r6 or r15

bump again, i really need an answer