Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

when i run my game, the animation will not play. why is this happening?

basically what i want is so when i equip my tool, it will play the custom equip animation

but it's not working so yea

here's a snippet of the code i dont know how to change the line numbers in this question thing (line 18 to 33)

staff.Equipped:Connect(function()
	--check if the body type is R6 or R15
	if character:FindFirstChild("Lower Torso") then--if the body type is R15
		local equipR15 = Instance.new("Animation")--makes animation instance
		equipR15.AnimationId = "rbxassetid://4967140370"--sets the animation ID
		local equipAnimTrackR15 = hum:LoadAnimation("equipR15")
		equipAnimTrackR15:Play()
	end
	
	if character:FindFirstChild("Torso") then--if body type is R6
		local equipR6 = Instance.new("Animation")--makes animation instance
		equipR6.AnimationId = "rbxassetid://4967132516"
		local equipAnimTrackR6 = hum:LoadAnimation("equipR6")
		equipAnimTrackR6:Play()
	end
end)

there is nothing in the output pls help

2 comments

0

are you running on a local script?

0

yes

1 answer

✓ Accepted answer

Don't use string, just use the animation.

staff.Equipped:Connect(function()
    --check if the body type is R6 or R15
    if character:FindFirstChild("Lower Torso") then--if the body type is R15
        local equipR15 = Instance.new("Animation")--makes animation instance
        equipR15.AnimationId = "rbxassetid://4967140370"--sets the animation ID
        local equipAnimTrackR15 = hum:LoadAnimation(equipR15)--Use name
        equipAnimTrackR15:Play()
    elseif character:FindFirstChild("Torso") then--if body type is R6
        local equipR6 = Instance.new("Animation")--makes animation instance
        equipR6.AnimationId = "rbxassetid://4967132516"
        local equipAnimTrackR6 = hum:LoadAnimation(equipR6)--Use name
        equipAnimTrackR6:Play()
    end
end)

More details:Wiki.

Edit: Btw I shorted the code.

1 comment

0

thx man

This discussion is preserved as it was. New answers, comments, and votes are closed.