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

How can I make an animation reload if the player dies?

Asked by
AZDev 590 Moderation Voter
8 years ago

I created an animation that plays when the player presses F, it works fine however when the player dies the animation no longer works after respawn.

Not sure if this is needed but this is my code:

local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")

local animcontrol = workspace.AnimationController
local slide = animcontrol.Slide
local animtrack

animtrack = player.Character.Humanoid:LoadAnimation(slide)

uis.InputEnded:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.F then
        animtrack:Play()
    end
end)

player.Character.Humanoid.WalkSpeed = 60
1
put the code into starterGui koolkid8099 705 — 8y
1
Where is this script? It's clearly a LocalScript, but where is it? lightpower26 399 — 8y
0
This is in player starter scripts. AZDev 590 — 8y

Answer this question