I’m currently trying to make them spawn on each spawn, basically like in a normal Minecraft hunger game. Can anyone give me an idea on how to do that?
I would recommend just placing each players root part at above the spawn position.
Though you could also set each player to a team corresponding to a spawn then kill them to make them spawn at the spawnpoint them remove the teams
Alright so you want to put all of the spawns in a folder. It would look something like this :
local spawns = --folder where your spawns go
local function teleportPlayers()
local availablespawns = {}
for i, v in pairs(spawns:GetChildren()) do --loop through all of the spawns in the folder and put them in a table
table.insert(availablespawns, v)
end
for i, v in pairs(game.Players:GetChildren()) do. --loop through all the players
local randomnumber = math.Random(1,#availablespawns)
v.Character.HumanoidRootPart.Position = availablespawns[randomnumber] --get a random spawn point and teleport the player there
table.remove(availablespawns,randomnumber) --remove that spawn so other players don't take the same one
end
end
Just call this function when you want to teleport them.
2 Likes
Oh, I actually didn’t think of that. Thank you so much for your help!
1 Like
Adding on to @XdJackyboiiXd21, I suggest making a folder for the gear and make them spawn randomly in chests, on the ground or wherever place they’ll be.
I have presents on the middle that gives random tools that I have in a folder
1 Like