Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make the text display the winners on line 40?

I'm making a game similar to plastic pirates using this game script I made but I need help on line 40 to display the winners and add points to their leaderstats

--1337ZombieGamer

local Base = game.Workspace.BasePlate


while wait() do
local m = Instance.new("Message", Workspace)
m.Text = "Match will start in 60 seconds"
wait(5)
m:remove()

wait(30)

local m = Instance.new("Message", Workspace)
m.Text = "Match will start in 60 seconds"
wait(5)
m:remove()

wait(20)

local m = Instance.new("Message", Workspace)
m.Text = "Match will start in 10 seconds"
wait(5)
m:remove()

wait(10)

local m = Instance.new("Message", Workspace)
m.Text = "Match begin! 120 Seconds Remain!"
Base.Transparency = 1
Base.CanCollide = false
wait(5)
m:remove()

wait(120)

local m = Instance.new("Message", Workspace)
m.Text = "Match Ended!"
wait(3)
m.Text = "Winners :" -- need help here
end

2 answers

This may or may not work. I'm assuming you want players who die during the game to be removed from the "winners".

--1337ZombieGamer and MrFlimsy

local Base = game.Workspace.BasePlate

while wait() do
local m = Instance.new("Message", Workspace)
for i = 60, 1, -1 do
    m.Text = "Match will start in "..i.." seconds"
    wait(1)
end

m.Text = "Match begin! 120 Seconds Remain!"
Base.Transparency = 1
Base.CanCollide = false
wait(5)
m:remove()

local alive = {}
local diedEvent
for _,v in pairs(game.Players:GetChildren()) do
    table.insert(alive,v.Name)
    diedEvent = v.Died:connect(function()
        table.remove(alive,v.Name)
    end)
end)

wait(120)

local m = Instance.new("Message", Workspace)
m.Text = "Match Ended!"
wait(3)
m.Text = "Winners:"
wait(1)
for _,v in pairs(alive) do
    m.Text = v
    wait(1)
end
m:remove()
diedEvent:disconnect()
alive = {}
end

1 comment

0

Haha thanks it worked and I see you added your name to the message on line 1 btw in the game I kept it there :P

You could try to connect it using .. and a string

This discussion is preserved as it was. New answers, comments, and votes are closed.