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

Local script breaks after dying or respawning and im wondering if anyone has a fix? Please help.

Asked by 3 years ago

Hey, So I been having trouble with this local script it works fine but after you die or respawn it breaks you cant do the animation anymore I'm kind of a noobie at this if you have a fix for this please tell me (its a Local Script in StarterPack btw)

local localPlayer = game:GetService("Players").LocalPlayer
local Character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local HandsUp = Humanoid:LoadAnimation(script.HandsUp)
local GS1 = Humanoid:LoadAnimation(script.GS1)
local Lay = Humanoid:LoadAnimation(script.Lay)
local Sit = Humanoid:LoadAnimation(script.Sit)
local Dog = Humanoid:LoadAnimation(script.Dog)

localPlayer.Chatted:Connect(function(msg)
    if string.sub(msg, 1, 10):lower() == "/e handsup" or string.sub(msg, 1, 14):lower() == "/emote handsup" then
        HandsUp:Play()
    elseif string.sub(msg, 1, 6):lower() == "/e gs1" or string.sub(msg, 1, 10):lower() == "/emote gs1" then
        GS1:Play()
    elseif string.sub(msg, 1, 6):lower() == "/e Dog" or string.sub(msg, 1, 10):lower() == "/emote Dog" then
        Dog:Play()
    elseif string.sub(msg, 1, 6):lower() == "/e lay" or string.sub(msg, 1, 10):lower() == "/emote lay" then
        Lay:Play()
    elseif string.sub(msg, 1, 6):lower() == "/e sit" or string.sub(msg, 1, 10):lower() == "/emote sit" then
        Sit:Play()
    elseif string.sub(msg, 1, 6):lower() == "/e end" or string.sub(msg, 1, 10):lower() == "/emote end" then
        HandsUp:Stop()
        GS1:Stop()
        Lay:Stop()
        Sit:Stop()
        Dog:Stop()
    end
end)
0
if u put a print in the function before everything, will it print? BulletproofVast 1033 — 3y
0
Yes it printed andioopmyson12 23 — 3y
0
hmm wait it only prints before I die but after I died it doesn't print neither does the local script work. andioopmyson12 23 — 3y

Answer this question