I have a round changing script but I need to give the player who has the most points a win at the end of the game.
this is the script:
local seconds = game.Workspace.Time
local ingame = game.Workspace.InGame.Value
local Game = game.Workspace.Game.Position
while true do
wait(1)
seconds.Value = seconds.Value - 1
if seconds.Value == 0 and ingame == 0 then
ingame = 1
seconds.Value = 20
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))
end
end
if seconds.Value == 0 and ingame == 1 then
ingame = 0
seconds.Value = 15
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i]:LoadCharacter()
end
end
end
This is what i tried (I know it doesn't mean anything):
local seconds = game.Workspace.Time
local ingame = game.Workspace.InGame.Value
local Game = game.Workspace.Game.Position
while true do
wait(1)
seconds.Value = seconds.Value - 1
if seconds.Value == 0 and ingame == 0 then
ingame = 1
seconds.Value = 20
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))
end
end
if seconds.Value == 0 and ingame == 1 then
ingame = 0
seconds.Value = 15
local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i]:LoadCharacter()
local highestplayer =
game.Players:GetPlayerFromCharacter(highestplayer)
highestplayer.leaderstats.Wins.Value = highestplayer.leaderstats.Wins.Value + 1
end
end
end
Thanks

2 comments
No no no what about 0 for loops
Table.foreach lol