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

[FIXED]why doesn't my animation play when clicked?

Asked by
seikkatsu 110
4 years ago
Edited 4 years ago

this is my script

------------------< variables >----------------
local uis = game:GetService("UserInputService")
local saber = script.Parent
local p = game.Players.LocalPlayer
local l = p.leaderstats
local equipped = false
local textBox = game.StarterGui.Strenght.TextLabel
local anim = script.Parent:WaitForChild("SwingAnimation")
------------------< code >---------------------
saber.Equipped:Connect(function()
    equipped = true
end)
saber.Unequipped:Connect(function()
    equipped = false
end)
uis.InputBegan:Connect(function(input1)
    local mouseIn1 = input1.UserInputType
    if equipped == true and mouseIn1 == Enum.UserInputType.MouseButton1 then
        l.Strenght.Value = l.Strenght.Value + 5
        local loadedAnim = p.Character.Humanoid:LoadAnimation(anim)
        loadedAnim:Play()
    end
end)

it's a local script and it's parented to a tool. all the parts work, exept the animation part. what did i do wrong?

0
It should work. Are there any errors? RealTinCan 217 — 4y
0
ummm yeah it says that the animation variable is a nil value seikkatsu 110 — 4y

1 answer

Log in to vote
0
Answered by
seikkatsu 110
4 years ago

fixed it. for any people that struggle with the same issue, when you edit the animation go in the edit tab and set the priority to action

Ad

Answer this question