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

Animations not playing after death?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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)
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. Persona3_FES 2 — 3y
Ad

Answer this question