Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make the player spawn again at a certain spawn after 3 "Waves"?

Asked by 5 years ago

Ok so the part for the map spawnpoint (player's spawnpoint) is named as "Spawn", I need help on how to make the players spawn again after a few certain waves.

01local roundMsg = game.ReplicatedStorage.Values:WaitForChild("roundMsg")
02local zombieCount = game.ReplicatedStorage.Values:WaitForChild("zombiesRemaining")
03local zombiesAlive = game.ReplicatedStorage.Values:WaitForChild("zombiesAlive")
04local gameInProgress = game.ReplicatedStorage.Values:WaitForChild("gameInProgress")
05local wave = game.ReplicatedStorage.Values:WaitForChild("Wave")
06local collectionservice = game:GetService("CollectionService")
07 
08 
09while true do
10    for i = 10,0,-1 do
11        roundMsg.Value = "Intermission: "..i
12        if i == 1 then
13            local map = math.random(1,7)
14            if map == 1 then
15                game.ReplicatedStorage.Maps.CornFarm:Clone().Parent = workspace.Map
View all 50 lines...

Alright so here is the main script for my game so far but I'm having trouble on how to make the players spawn again after a few certain waves

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Running off the top of my head you'll want to make use of two things. 1. You'll want to disable the CharacterAutoLoads feature found under every player. A quick example being:

1game:GetService("Players").PlayerAdded:Connect(function(plr)
2    plr.CharacterAutoLoads = false
3end)

And 2. You'll want to use the Player:LoadCharacter() feature which does what it says on the tin. So for each player that isn't currently alive you can use LoadCharacter on them after the respawn requirements you want to set in place are met.

0
Alright my good sir, where should I place your written script? Simpletton 82 — 5y
0
It really just depends on how you prefer to organize your scripts but me personally, I would put it in a script by itself in the ServerScriptService. XxTrueDemonxX 362 — 5y
0
Simpletton, my advice is don't copy his script and use it for your own purposes. That will teach you nothing really take a moment to understand what he just said and showed you and attempt it yourself. This site in general is here to help any questions you may have feel free to post. johndeer2233 439 — 5y
Ad

Answer this question