My round system moves every player once one dies

For some reason my round script respawns every player if one dies. So lets say one guy resets, the round system moves every player to the original spawn point or a totally different map. I really need help since I don’t know whats wrong with it. The script is below.

–Server–

wait()
local Map1 = game.ServerStorage.Maps.BoardWalk 
local Map2 = game.ServerStorage.Maps.ShipMap

local spawnthing = game.Workspace.SpawnLocation

local function RanMap()
	local players = game.Players:GetChildren()
	local RanNum = math.random(1,2)

	if RanNum == 1 then 
		script.Timer:FireAllClients()
		Map1:Clone().Parent = workspace
		for i = 1, #players do 
			players[i].Character:MoveTo(Vector3.new(-295.952, 23.407, 731.36)) -- Spawn Part Position in map
		end

	elseif RanNum == 2 then 
		script.Timer:FireAllClients()
		Map2:Clone().Parent = workspace
		for i = 1, #players do 
			players[i].Character:MoveTo(Vector3.new(-712.07, 216.8, -579.04))	
			spawnthing.Position = Map2.Spawns.SpawnPoint.Position
		end
	end
end


local function Wipe() 
	local Map1Find = workspace:FindFirstChild("Map1")
	local Map2Find = workspace:FindFirstChild("Map2")

	if Map1Find then
		Map1Find:Destroy()
	elseif Map2Find then 
		Map2Find:Destroy()
	end
end
script.Finished.OnServerEvent:Connect(function(Player)
	local players = game.Players:GetChildren()
	for i = 1, #players do 
		players[i].Character:MoveTo(Vector3.new(-787.03, 154.744, -146.242)) -- Lobby SpawnPoint Position
		spawnthing.Position = game.Workspace.Reactor.SpawnPos.Position
	end
	wait(2)
	Wipe()
	wait()
	script.LobbyTimer:FireAllClients()
end)

script.FinishedLobby.OnServerEvent:Connect(function(Player)
	RanMap()

end)

RanMap()

–Local–

local Timer = script.Parent.Parent.Timer
local Frame = script.Parent.Parent.Transition

local function LobbyToGame()
	Frame.Visible = true
	Frame:TweenPosition(UDim2.new(-0, 0,-0, 0),"Out","Sine",1)
	wait(1)
	Frame:TweenPosition(UDim2.new(-1, 0,0, 0),"Out","Sine",1)
	script.Parent.FinishedLobby:FireServer()
	wait(2)
	Frame.Visible = false
end

script.Parent.Timer.OnClientEvent:Connect(function()
	
	local seconds = 360 -- Each Round Timer (Changable)
	
	local minutes = seconds/60
	
	repeat
		seconds = seconds - 1
		if seconds < 60  then
			Timer.Text = "Game In Progress.. ".. seconds
		elseif seconds >= 60 then
			Timer.Text = "Game In Progress.. ".. minutes 	
		end

		wait(1)
	until
	seconds <= 0 
	script.Parent.Finished:FireServer()

end)

script.Parent.LobbyTimer.OnClientEvent:Connect(function()
	local seconds = 30 -- Lobby Timer (Changable)
	repeat
		seconds = seconds - 1
		Timer.Text = "Lobby: ".. seconds 
		wait(1)
	until
	seconds <= 0 
	LobbyToGame()
end)

*edited answer in answers lol x

Hm how do you think I can fix that. Sorry im a novice at scripting

What is the parent of the server script?

screen gui and the local script is inside the script

well thats your problem.

Every player that joins will have the round script in his PlayerGui now which is not good…

Put the ServerScript into ServerScripService.
And all remote events you have there you put into RepliactedStorage so client and server can access them

*Note your script is very very unsafe against exploiters

*edit if you want you can add me to team create and I will help you fix this if you want

ye ill do that my user is azaabbie this is a alt

were you able to fix it? Sorry for wasting your time

i was afk sorry
Im gonna start fix it now if you want i can make you a whole new round system

no way you would do that for me. Thanks man truly. WHen I get better I’m gonna helo people and pass on your kindness

2 Likes

So how do you want it to work?

I just need it to select a map from voting, teleport them into the game, assign teams, spawn each player in some random spawns and then once the rounds done it can just teleport them back to lobby.

but I just need the lobby and round part basically

do you mean a voting ui? and what teams name or color

ye a voting ui and 2 teams Purple and Orange

ok no problem i will do that give me 30-60 mins

1 Like

ok so everything is done what you told me

To change settings go to ServerScriptService>Modules>Round and you will find a comment “–[Settings]–”
You can change it there

If you have any questions or you want me to change something in the script just message me on roblox or in discord NOSTALIGATOR#3270

Good luck!

1 Like

Im so sorry I was afk thanks a lot!

1 Like