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

"Stop is not a valid member of Animation" & "Play is not a valid member of Animation" ?

Tool.Equipped:Connect(function()
	local Idle = Instance.new("Animation")
	Idle.Name = "Idle"
	Idle.Parent = script.Parent
	Idle.AnimationId = "rbxassetid://4760107293"
	local Animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle)
	Idle:Play()
end)

Tool.Unequipped:Connect(function()
	local Idle = script.Parent.Idle
	Idle:Stop()
	Idle:Destroy()
end)

1 answer

✓ Accepted answer

Well. I'm not sure it's the problem, but I will try to help. Well, when you instanced something, and didn't delay the next code, the script can not find the instance, what do I mean? Imagine a 2 scripts are running in the same time, the script won't find the instance "Idle" since you instanced it in the same time when it finished the code, instead of saying :

local Idle = script.Parent.Idle

It basically searches for it at the same moment when it instanced, you will wait for child.

local Idle = script.Parent:WaitForChild("Idle")

That's how you fix it. Hope it helped.

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