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

Lift Animatioon not playing no clue why ?

Asked by 4 years ago
Edited 4 years ago

Hello Everyone.

I have a problem with a Weight (Tool) i made 2 Animatiions 1 for Action 1 for Idle

My problem is that the idle animation plays like 2 secoonds and the lift animation does nothing.

(i'm new in LUA coding so sorry :) just knowing php)

Here is the code in the Tool.

local db = false
local tool = script.Parent
local plr = tool.Parent.Parent
local character = plr.Character
local strengthPerClick = 5

local anim1 = tool:WaitForChild("LiftAnim")
local animtrack1 = character.Humanoid:LoadAnimation(anim1)

local anim2 = tool:WaitForChild("IdleAnim")
local animtrack2 = character.Humanoid:LoadAnimation(anim2)


tool.Activated:Connect(function()
    if not db then
        db = true
            warn("Tool used")
        animtrack1:Play()
        plr.leaderstats.Strength.Value = plr.leaderstats.Strength.Value + strengthPerClick
        wait(1.5)
        db = false
    end
end)
tool.Equipped:Connect(function()
    warn("Tool Equipped")
    character.Humanoid.WalkSpeed = 0
    animtrack2:Play()
end)

tool.Unequipped:Connect(function()
    warn("Tool Unequipped")
    character.Humanoid.WalkSpeed = 16
    animtrack2:Stop()
end)
0
Make sure the animation priority is higher than movement uhSaxlra 181 — 4y
0
Exactly that was the problem thank you :) Ravage1337 35 — 4y

1 answer

Log in to vote
0
Answered by
SioZex 15
4 years ago

Um I think you may of made a mistake, " plr = tool.Parent.Parent" That's all I'm going to say.

0
no it's workiing like that. I had to change the animation priority Ravage1337 35 — 4y
Ad

Answer this question