I am currently messing around with animations and I'm running into an issue I can't seem to get around...
The animation plays correctly the first time when the character has existed prior however, when the character dies and I want the animation the play once again, it does not happen. Does anyone have any suggestions to what I could try?
Thanks!
local player = game:GetService("Players").LocalPlayer local character = player.Character or player.Character:wait() local animation = character.Humanoid:WaitForChild("holdAnimation") local playHoldAnimation = character.Humanoid:LoadAnimation(animation) redGun = player.Backpack:WaitForChild("Red Laser Gun") blueGun = player.Backpack:WaitForChild("Blue Laser Gun") redGun.Equipped:connect(function() print("fired") playHoldAnimation:Play() playHoldAnimation.KeyframeReached:connect(function(keyFrameName) if keyFrameName == "here" then playHoldAnimation.TimePosition = .25 end end) end) redGun.Unequipped:connect(function() playHoldAnimation:Stop() end)
I just placed the code in another LocalScript and it seems to be working. This was odd. Thanks though!