Hello, I tried to follow Alvin Blox, how to make a fighting game but my players did not spawn into the map. I could not add anymore. But if you need it, I can dm it to you!
-- Define variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Serverrstorage = game:GetService("ServerStorage")
local MapsFolder = Serverrstorage:WaitForChild("Maps")
local Status = ReplicatedStorage:WaitForChild("Status")
local GameLength = 300
local reward = 1
-- Game Loop
while true do
Status.Value = "Waiting for enough players"
repeat wait(1) until game.PLayers.NumPlayers >= 2
Status.Value = "Intermission"
wait(15)
local plrs = {}
for i, player in pairs(game.Players:GetPlayers()) do
if player then
table.insert(plrs,player) -- Add each player into plrs table
end
end
wait(2)
local AvailableMaps = MapsFolder:GetChildren()
local ChosenMap = AvailableMaps [math.random(1,#AvailableMaps)]
Status.Value = ChosenMap.Name.." Chosen"
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = workspace
-- Teleports players to the map
local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")
if not SpawnPoints then
print("Spawnpoints not found!")
end
local AvailableSpawnPoints = SpawnPoints:GetChildren()
for i, player in pairs(plrs) do
if player then
character = player.Character
if character then
-- Teleport them
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1]
table.remove(AvailableSpawnPoints,1)
** You are now Level 5! **