Info: Script is a localscript. Script is in StarterPack. Gui is in PlayerGui. ]] Guys I need help. This script is supposed to make the texto of a TextLabel change when a player dies.
local player = game.Players.LocalPlayer
local humanoid = player.Character:FindFirstChild("Humanoid")
local text = player.PlayerGui:WaitForChild("DeathGui").Background.Bar.DeathMessage
local messages ={"You did your best!","Wait, whaat!?","It's ok!","You can't do better?","Don't give up!"}
function changemessage()
for i = 1,1 do
for i,v in pairs(messages)do
end
local m = math.random(1,5)
print(m)
local text1 = messages[m]
text.Text = text1
print(messages[m])
end
end
player.Character:FindFirstChild("Humanoid").Died:connect(function()
player.PlayerGui.DeathGui.Background.Visible = true
wait(.3)
player.PlayerGui.DeathGui.Background.Bar:TweenSize(UDim2.new(0,800,0,200),"In","Linear",.1)
wait(.1)
changemessage()
player.PlayerGui.DeathGui.Background.Bar.DeathMessage.Visible = true
script.Fail:Play()
end)
It Works once the player dies but the second time the player dies it won't change.. I don't know why. Anyone willing to help for some rep? I'd really apreciate it :C!

3 comments
Hi! I wasn't online so I couldn't answer you, but I see someone yet did. Luck with your game!
change it to appear when humanoid health is equal to 0?
Didn't work aim.. Can you help me?