Animation Not Working

So my animation won’t play in my local script


local stands
local rots 
local heds 
local faces
local torss 
local rarms
local larms
local rlegs 
local llegs 
local donutanim 

if chr:FindFirstChild("StandS") then
	

	isuser.Value = true

end






if isuser.Value == true then
	stands = chr:WaitForChild("StandS")
 rots = stands:WaitForChild("StandHumanoidRootPart")
 heds = stands:WaitForChild("Stand Head")
 faces = heds:WaitForChild("face")
 torss = stands:WaitForChild("Stand Torso")
 rarms = stands:WaitForChild("Stand Right Arm")
 larms = stands:WaitForChild("Stand Left Arm")
 rlegs = stands:WaitForChild("Stand Right Leg")
	llegs = stands:WaitForChild("Stand Left Leg")
	donutanim = human:LoadAnimation(stands.StandHumanoidRootPart.Donut)

end

heres me defining everything. I have more upwards

function strongpunch()
	if activu == true then return end
	if summoned.Value == true then return end

	if strongpunchcooldown == true then return end
	if chr.Disabled2.Value == true then return end
	

	activu = true
	punchcombo = 1
	strongpunchcooldown = true
	strongpunchanim:Play(0.1,1,1.1)
	InitialStrongSFX:Play()
	if chr:GetAttribute("Stunned") then return end

	wait(.45)
	if chr:GetAttribute("Stunned") then
		activu = false
		return end

	EndStrongSFX:Play()
	fxevent:FireServer("Effect", Vector3.new(.3, .3, .3),Vector3.new(6, 6, 6),BrickColor.new("Institutional white"),hrp.CFrame * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) * CFrame.new(0, -5, -1))
	for _ = 1, 2 do
		wait()
		hito(rightarm, rightarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5.5, 11, 0.5, 0.25, hrp.CFrame.lookVector * 50,"rbxassetid://281156569",.8,.3,true)
	end
	wait(.4)
	activu = false

	
	wait(5)
	strongpunchcooldown = false
end

Heres the error i get

It was working before i changed the way the variables were defined

2 Likes

What is on line 239 exactly? I do not want to count 239 lines

donut:Play()

the part for playing the animation

Maybe just do

donutanim:Play() instead of EndStrongSFX:Play(),
Since I can't see the line problems thats my only solution

But that would play sounds instead of animation.

Where did you define donut variable

grafik
How would it play a sound?

My bad a read that wrong, I already played it in the script. Thats why im getting that error

Bottom of the first script chunk thing

Is it a typo it says
donutanim = …
but you did donut:Play()

I basically dont know what lines im looking at ngl.
GalaxyRIP324 probably has the same problem.

Bottom of the first line. Thats at the top

1 Like

grafik
Where are u even trying to play that animation?

Yes I understand im saying if you did
donutanim:Play() does it fix

My guess is that

if chr:FindFirstChild(“StandS”) then

StandS does not exist in the first milisecond the script is run so therefore the animation would never be loaded

If you want to make sure it exists you might want to try :WaitForChild() instead

1 Like

I’ll try that

thank you for the help

1 Like