How do I end the match and give the last player a win?

So I’m trying to do like a last man standing sort of battle royale game, how would I tell if theres 1 player on the “In Game” Team? And how would I give them the win?

1 Like

So for example

local plr = game.Players:GetChildren()



for _,plr in pairs(game.Players:GetPlayers()) do
if plr.Team == game.Teams["In Game"] and #plr == 1 then
game.ReplicatedStorage.Notification:FireAllClients("Winner: "..plr.Name)
elseif plr.Team == game.Teams["In Game"] and #plr >= 2 then
game.ReplicatedStorage.Notification:FireAllClients("Players standing: "..#plr)
end
end

And in clientside:

game.ReplicatedStorage.Notification.OnClientEvent:Connect(function(args)
script.Parent.Win.Visibile = true
script.Parent.Win.PlrName.Text = args
end)
4 Likes
local plrs = game.Players:GetPlayers()

if #plrs == 1 then
print("1 player in game")
end

Where do you put the scripts in?