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

Why doesn't this animation load porperly?

TOOL.Unequipped:Connect(function()
	for i, idle in pairs(IDLEANIM) do
		local HUM = TOOL.Parent:FindFirstChildOfClass("Humanoid")
		local IDLEANIMS = HUM:LoadAnimation(idle)
		IDLEANIMS:Stop()
	end
end)

At line 4, it prints as an error, saying "attempt to index nil with 'character'", and doesn't stop the animation. All variables are earlier on in the script, so its not those. I'm pretty sure it has something to do with the fact that when the tool is unequipped, it can't find the humanoid through script.Parent, but I still don't know how I'd fix it. If you know how, please tell me. Thanks.

1 answer

once u unequip the tool goes into backpack so u'd need to do TOOL.Parent.Parent.Character and then if u wanted to stop an animation u'd need the animation track that u used to play the animation

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