-
What do you want to achieve?
Play animation on equipped event. -
What solutions have you tried so far?
I don’t think there are any solutions since I cannot see a single wrong thing in the local script.
The local script:
local plr = game.Players.LocalPlayer
repeat wait()
until plr.Character
local char = plr.Character
local h = char:FindFirstChild("Humanoid") -- I also tried WaitForChild(), doesn't work.
local equipped = false
local IdleTrack = h:LoadAnimation(script.Parent.Idle)
--
script.Parent.Equipped:Connect(function()
equipped = true
h.Running:Connect(function(speed)
if equipped == true then
if speed == 0 then
IdleTrack:Play()
else
IdleTrack:Stop()
end
end
end)
end)
--
script.Parent.Unequipped:Connect(function()
equipped = false
IdleTrack:Stop()
end)
--
-
What is the issue?
The animation won’t play.