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

3 comments
put the code into starterGui
Where is this script? It's clearly a LocalScript, but where is it?
This is in player starter scripts.