Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Animations not playing after death?

I don't know how to fix this issue. No this is not the full script, this is about 20 out of 240 lines. This is where all the anims are refrenced. I simply don't know what to do to fix this after the player dies. It's a local script

local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local StunCheckFolder = plr:WaitForChild("StunCheck")
local Mouse = plr:GetMouse()
local Debounce = true
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:wait()
local humanoid = Character:WaitForChild("Humanoid")
--04828543601
--5539989502
local anim1= script.Animation1
anim1.AnimationId = "rbxassetid://7329609322"
local Anim1 = humanoid:LoadAnimation(anim1)

local anim2= script.Animation2
anim2.AnimationId = "rbxassetid://7329603745"
local Anim2 = humanoid:LoadAnimation(anim2)

local anim3= script.Animation3
anim3.AnimationId = "rbxassetid://7329605874"
local Anim3 = humanoid:LoadAnimation(anim3)

local anim4= script.Animation4
anim4.AnimationId = "rbxassetid://7329607540"
local Anim4 = humanoid:LoadAnimation(anim4)

1 answer

instead of using local Character = player.Character or player.CharacterAdded:wait(), instead do:

player.CharacterAdded:connect(function()
	local anim1= script.Animation1
	anim1.AnimationId = "rbxassetid://7329609322"
	local Anim1 = humanoid:LoadAnimation(anim1)
	 
	local anim2= script.Animation2
	anim2.AnimationId = "rbxassetid://7329603745"
	local Anim2 = humanoid:LoadAnimation(anim2)
	 
	local anim3= script.Animation3
	anim3.AnimationId = "rbxassetid://7329605874"
	local Anim3 = humanoid:LoadAnimation(anim3)
	 
	local anim4= script.Animation4
	anim4.AnimationId = "rbxassetid://7329607540"
	local Anim4 = humanoid:LoadAnimation(anim4)
end)

1 comment

0

this is because the character part triggers only once, whereas :connect()ing the player.CharacterAdded event to a function() always ensures that whenever that event is fired, the function() runs everytime.

This discussion is preserved as it was. New answers, comments, and votes are closed.