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

How do I use this script to display who won the minigame?

I need it to display who won the minigame; and/or who is still alive. I'm also trying to make it so it would award the winner(s) 10 points.

msg.Parent = game.Workspace
msg.Text = "Winner(s)!"

2 comments

0

The way I made my script is that, after 120 seconds, it displays the script above. But it doesn't display the players who won. I dont know how to make it so that it will.

1 answer

✓ Accepted answer

If you have a leaderboard script, where there is a value called 'Alive' or 'Winners' then you can do this.

-- List the players who are still alive and add them onto the winner's list.

local p = game.Players:GetPlayers()
local winners = {}

for i = 1, #p do 
	if p[i].leaderstats["Alive"].Value then
		print(p[i].Name.. ' is alive!')
		table.insert(winners, p[i].Name)
	end
end

Displaying the winner message.

-- Should be in the same script to get the winners.

local msg = "Winners are"

for j = 1, #winners do 
msg = (msg..", " ..winners[j])
end

local gm = Instance.new("Message")
gm.Parent = Workspace
gm.Text = msg
wait(5)
gm:Destroy()

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