So I have some code for my animation, whenever someone fires a UserInput it will then play the animation. Here's the code:
--These are the variables for the animation
local Player = game.Players:WaitForChild("LocalPlayer")
local character = Player.Character or Player.CharacterAdded:wait()
local BlockAnimation = game.ReplicatedStorage.Animations:WaitForChild("BlockAnimation")
local Animation = character:WaitForChild("Humanoid"):LoadAnimation(BlockAnimation)
--This is the userinputservice that when F is pressed it will play the animation.
game:GetService("UserInputService").InputBegan:Connect(function(KeyDown, gameProcessed)
if not gameProcessed then
if KeyDown.KeyCode == Enum.KeyCode.F then
Animation:Play()
end
end
end)
I do have a inputended etc, but whenever I reset my character. Or I die whenever I press F my animation won't play. So I'm wondering if this is just like some problem with the actual Character object respawning.. do I have to wait for it or something?

2 comments
where are the location of the script?
Starter Player Scripts and sup hertt hru