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

Animation stuck playing?

This question is also on the ROBLOX Official forums

I made some animations to put on a tool. They play perfectly fine. My problem is making the animations stop. They stop...for a few seconds. Then they get stuck playing. Sometimes the tool will destroy itself. Here's the unequip function:

Tool.Unequipped:connect(function()
	wait(0.1)
	for i = 1, 5 do
		hold:Stop()
		drink:Stop()
		wait()
	end
	Tool.Enabled = true
end)

My equip function:

--Very clever I see...
Tool.Equipped:connect(function(mouse)
	Tool.Enabled = false
	WaitForChild(Player.Character["Right Arm"], "RightGrip")
	local oldweld = Player.Character["Right Arm"]:FindFirstChild("RightGrip")
	if oldweld then
		weld = Instance.new("Motor6D", Player.Character["Right Arm"]) --You are now allowed to move the handle.
		weld.CurrentAngle = 0
		weld.DesiredAngle = 0
		weld.MaxVelocity = 0
		weld.Part1 = Tool.Handle
		weld.Part0 = Player.Character["Right Arm"]
		weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
		weld.C1 = CFrame.new(1.17616272, -0.099999994, 0.217036128, 0.217036352, 0.976163387, 0, 0, 0, -1, -0.976163507, 0.217036322, 0)
		oldweld.Part0 = nil
		oldweld.Part1 = nil
	end
	drink = Player.Character.Humanoid:LoadAnimation(Tool.DrinkAnimation)
	hold = Player.Character.Humanoid:LoadAnimation(Tool.HoldAnimation)
	wait()
--	Player.Character.Humanoid:LoadAnimation(Tool.EquipAnimation):Play()
--	wait()
--	Tool.Handle.OpenSound:Play()
--	wait(2)
	hold:Play()
	Tool.Enabled = true
	mouse.Button1Down:connect(function()
		if Tool.Enabled then
			Tool.Enabled = false
			drink:Play()
			wait(2)
			Tool.Handle.OpenSound:Play()
			wait(0.5)
			Tool.Handle.DrinkSound:Play()
			wait(5-(2+0.5))
			Tool.Enabled = true
		end
	end)
end)

Any ideas as of why it gets stuck playing?

Here's the place

1 answer

Most likely just a error in the script is causing it to run the suddenly stop when running in to the error try debugging it in-game with the ROBLOX Console (F9) .

1 comment

0

I've taken a look. It has no errors. Just gets stuck

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