I know these kinds of topics are already there but As I have said I am really new to scripting and don't really understand many lines of code which results in understanding nothing and thus I will be dearly grateful if someone makes me understand the concept I don't want someone to spoon-feed me the code but instead guide me by the line so that I can understand by myself and script it
COMMUNITY QUESTION
how do I make a round system where after everyone dies the round ends ? I wanna get the core concept
1 answer
this is incomplete and won't work but something like this could help
local Players = game:GetService("Players")
local playersInRound = {} -- empty table for now
-- when the round starts
playersInRound = Players:GetPlayers() -- put every player in the table
for i, player in pairs(Players:GetPlayers()) do
player.Character.Humanoid.Died:Connect(function(player) -- make this run every time someone dies
if table.find(playersInRound, player) then -- if they are still in the round, remove them from the table
table.remove(playersInRound, table.find(playersInRound, player))
if #playersInRound == 0 then -- when there is nobody in the round, the table will be empty so last index will be 0
-- do code to end the round
end
end)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
