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)

3 comments

0

if u put a print in the function before everything, will it print?

0

Yes it printed

0

hmm wait it only prints before I die but after I died it doesn't print neither does the local script work.