Okay, so i have a pretty stupid game where there is a default baseplate and a hole in the floor, and there is a sign telling you not to jump into said hole, and if you do you get stopped by a barrier that kill you, it pops up on onscreen gui with text, i wanna know how to make the death messages random, the script is below.
Popup = script.Parent.Popup
Ready = true
function onTouch(hit)
local h = hit.Parent:FindFirstChild(“Humanoid”)
if h ~= nil and Ready == true then
Ready = false --Nopes.
local plyr = game.Players:FindFirstChild(h.Parent.Name)
local c = Popup:clone()
c.Parent = plyr.PlayerGui
local s = Sound:clone()
s.Parent = plyr
wait(2)
c:remove()
s:remove() .
wait(.1)
Ready = true
end
end
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local messages = {
"Try better, newbie!";
"Wasted";
}
humanoid.Died:Connect(function()
local NewMessage = messages[math.random(1, #messages)]
script.Parent.TextLabel.Text = NewMessage
end)