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

Minigame script detect players?

Hi,

So I have a script that when the minigame starts, it add all the players to the table. When they die, it removes them from the table. Right now, this script removes the players. It also checks to see if there is only one player left in the game, and if so, they are the winner. How would I go about making it so that once the time is up, it gets all the player that have not died and display there name?

Thanks

  • This is not a request. I am just asking for someone to tell me how to do this.

4 comments

0

Like for guidance.

0

Haha

0

Please attempt to do this yourself and include your code. If you don't have any idea where to start, use a for loop on the Players table and print their names.

2 answers

Add Bool value called "Dead"! And Add Bool value again called "IsPlaying"!

(NOTE: This is LocalPlayer Scripts)

local plr = game.Players.LocalPlayer
local DeadBool = Instance.new("BoolVal", plr)
local IsPlaying = Instance.new("BoolVal", game.ReplicatedStorage)
plr.Character.Humanoid.Died:connect(function()
if IsPlaying == true then
DeadBool.Value = true
end
end)

That's helpful?

Putting # before a table's name will return the amount of indexes in that table, so you can check if that is less than or equal to 1. And the whole showing players who are alive thing kind of depends on what you are doing, but using for i=1,#aliveplayers do can get you all the players.

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