My round system isnt working properly!

Thanks for letting me know whats the misstake but may you give the fixxed piece of code i need? I’m not that great of a coder and thats also why. Would be nice :grin::+1:

2 Likes

no one’s gonna write the code for you. If you need to separate the player from the others, you should just use localplayer instead

2 Likes

Then just give an example of the changes i have to make because i’m not that experienced man you could like tell the line and why i have to replace it with to may get it work but your answer doesnt have to be as rude as you made it.:unamused::neutral_face:

2 Likes

may you give an example of how i could use the function since im preatty new to scripting?

2 Likes

Maybe it works like that because you forgot to set the inRound value back to normal.
Try doing that at then end of the round.

you can look at this:

https://devforum.roblox.com/t/removing-a-player-from-table-when-dead/1055421

Imma have a look and ill tell you if i dont undestand it or unserstand it in hope tat you may help me

This might work if you alter it too:

local connection
for _, player in pairs(Game:GetService(“Players”):GetChildren())
local char = player.Character
connection = char:WaitForChild(“Humanoid”).Died:Connect(function() – runs the function when player has died
print(player.Name … " has died!")
if table.find(survivalwinners, player.Name) then – wont run if the player isn’t in the table
connection:Disconnect() – This part makes it so if the same player dies again the script wont run. This also reduces lag so yes. If you want to make it so the script keeps running even though the player has died once then remove this part
local location = table.find(survivalwinners, player.Name) – gets the location of player in table
table.remove(survivalwinners, location) – removes the player from tabl
end
end)
end

I’ve came up with a solution:

local playing = {}
			local lobby = {}-- Create an empty table to store playing players

			-- Loop through all players in the game
			for _, plr in pairs(game.Players:GetPlayers()) do
				-- Check if the player has a team (is playing)
				if not plr.Team then
					inRound.Value = true
					table.remove(lobby, plr)
					table.insert(playing, plr)
					Checking.Value = true
				else
					inRound.Value = true
					table.remove(playing, plr)
					table.insert(lobby, plr)
					Checking.Value = false
					
				end
			end

but it ened up not working and the timmer for round just stopped may you help me?

whith what should i replace it with

I’m pretty sure it’s because you are removing the player directly from the plr value, I think you need to use table.find to retrieve the index of that specific player. Also what’s the point of having a lobby and a playing table? If the player is in the game it is certain that they are in the lobby

can you show an example on how it could/should look?

This might not work:
(Sorry if this doesn’t work I wrote it on mobile.)


Local character = game:GetService(“Players”).Character or CharacterAdded:Wait()

for i, player in pairs(game:GetService(“Player”):GetChildren()

Table.insert(Playing, player.Name)

character.CharacterRemoving:Connect(Function()
If table.find(Playing, player.Name) then
PlayerLocationInTable = table.find(Playing, player.Name)
table.remove(Playing, PlayerLocationInTable)
End
End)
End```

is this just an example or can i replace it with smth?

You probably can use it but it might need some adjustment or fixing some things up

Roblox gave me this script:

			local playing = {}
			local lobby = {}-- Create an empty table to store playing players
			for _, v in pairs(game:GetService("Players"):GetPlayers()) do
				if v.Team == game.Teams.Playing then
					table.insert(playing, v)
				elseif v.Team == game.Teams.Lobby then
					table.insert(lobby, v)
				end
			end
			
			if #playing <= 1 and not roundEnded then -- If there is only one player left playing the game...
				roundEnded = true -- Set the round as ended.
				winningPlayer = playing[1] -- The winning player is the last remaining player.
			elseif i == 0 and not roundEnded then -- If time has run out and no winner has been found...
				roundEnded = true --
			-- Now, the 'playing' table contains all the players who are currently playing
			-- You can use this 'playing' table for further processing or checks

but then at the end of the code this here gets marked red (justs the (round)):

spawn(round)

I still think you should just put the inRound value back to normal instead of adding all the other unnecessary things.

May you give and example what i may input in there instead of this all??

After the last wait you reset the inRound value to the value it was before.

where??? in my whole code the last one or what?? if so show me how the code should look like