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

Lift Animatioon not playing no clue why ?

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)

2 comments

0

Make sure the animation priority is higher than movement

0

Exactly that was the problem thank you :)

1 answer

✓ Accepted answer

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

1 comment

0

no it's workiing like that. I had to change the animation priority

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