Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Animation stuck playing?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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) .

0
I've taken a look. It has no errors. Just gets stuck lightpower26 399 — 9y
Ad

Answer this question