How to make players respawn every new round

  1. What do you want to achieve? Keep it simple and clear!
    when the next advancing round comes i want players whos died or just joined to respawn and the script to add tag alive to the player so there recognized as alive players keeping the new or dead players out the lobby and the rounds going until everyone dies
    im new so dont just tell me add remote function or something just help me idk how
1 Like

You only need to teleport players into the specific game area when the round starts and have a spawnlocation set to your lobby.

ok so how do i do that i dont know sorry

It seems like you don’t know very much about scripting. It may be best for you to start with more simple concepts. I’d recommend looking around the DevHub and searching for videos on YouTube. In the event that you still want to attempt this, I’ll point you in the right direction with a few helpful resources.

Players - This has many functions that can help you, like PlayerAdded. This is also the container that holds all players in the game.

Teams - This can be used to set specific spawns for teams so that you can have a team for the “Alive” players, and a team for the “Dead” players.

Beyond these, I’d recommend searching for tutorials online. I’m sure there are tutorials going over this that you could find online.

3 Likes

This is very simple, you just want to set the position of the humanoidrootpart to a certain position or to the position of a part, then you can just have a spawnlocation in your lobby. I’m pretty sure that there’s several tutorials on how to do this.

local timer = --timerHere

local plr = game.Players.LocalPlayer
--Teleport the player to the round
while true do
  wait(1)
   timer = timer - 1
end
--Teleport the player back to the spawn

no i looked theres nun and yall confusing me lol

Player:LoadCharacter() will force a player to spawn

guys yall not understanding like i really need a lesson like yall only telling what im supposed to do but not teaching me how to use it like i dont know what to do player:loadCharacter() or where even to put it :neutral_face:

Like @Pr0pelled stated earlier, you don’t seem to know a whole lot about scripting (which is not a bad thing). Usually for beginners it is much better to watch a bunch of tutorials, read the developer wiki (linked here), and do smaller projects starting off to get a better grasp on how everything works.

I remember the first thing I wanted to do when I just started scripting was to make a massive open world game, but then I quickly realized I barely knew how loops worked.

Basically, just stick with smaller stuff for now as a beginner, you’ll benefit in the long run.

oh no i know how to do some stuff just some things i dont

put this in a regular script and it will respawn every player, all it does is go through all the players and loads their character

for player in ipairs (game.Players:GetPlayers()) do
    player:LoadCharacter()
end

if you want it to only respawn dead players you can just add a check on the humanoid

for player in ipairs (game.Players:GetPlayers()) do
    local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")
    if humanoid and humanoid.Health == 0 then
        player:LoadCharacter()
    end
end

This article may help you understand how to use Player:LoadCharacter()

It’s a built-in function, which basically respawns the player (removes tools, resets health, etc.)
Here’s what I would do:

-- Insert the round script here or something
wait()
local player = game.Players.LocalPlayer
player:LoadCharacter() -- You can just end the script here if you already have spawnpoints.
-- Then I would set the player's character to the CFrame if I want them to spawn in a specific area
local spawn = workspace.Part -- Change this to whatever
local cframe = spawn.CFrame
player.HumanoidRootPart.CFrame = cframe -- this only works if the variable is above the area you want the player to spawn in.
end
1 Like

does this make them spawn only everytime a advancing wave comes and at the current map?

thank you bro this was helpfull

put the block of code where you want them to respawn, like and the start of a round in your scripts

ok thank you-----

it still isnt working for me guys :roll_eyes:

this is the part my script that involves my round script

				if v.Name == "spawner" then
					collectionservice:AddTag(v, "spawner")
				end
			end
			for i, v in pairs(game.Players:GetPlayers()) do
				collectionservice:AddTag(v.Character, "Alive")
				v.Character.HumanoidRootPart.CFrame = workspace.Map:FindFirstChildOfClass("Model").Spawn.CFrame
			end
			roundMsg.Value = "Round In Progress"
			zombieCount.Value = 10
			zombiesAlive.Value = 10
			wave.Value = 1
			gameInProgress.Value = true
			repeat
			if #collectionservice:GetTagged("Alive") > 0 then
					if zombiesAlive.Value == 0 then
					wave.Value = wave.Value + 1
					zombieCount.Value = 10 * wave.Value
					zombiesAlive.Value = 10 * wave.Value
				end
				elseif #collectionservice:GetTagged("Alive") == 0 then
				gameInProgress.Value = false
			end
			wait(1)
			until gameInProgress.Value == false
				workspace.Map:ClearAllChildren()
	             end
	                    
	wait(1)
	end```