The script does not teleport players, start the game loop. No errors are shown when executed, but the game,( as I said) will not start. If there are errors that I am unaware of that would stop the script from working, please tell me. The game loop is supposed to teleport, Put players in a table and monitor the game.
Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MapsFolder = ServerStorage:WaitForChild("Maps")
local Status = ReplicatedStorage:WaitForChild("Status")
local GameLength = 120
local reward = 1
-- Game Loop
while true do
Status.Value = "Waiting for more Players..."
repeat wait(1) until game.Players.NumPlayers > 1
for i = 15, 0, -1 do
local fulltext = "("..i..")" -- change to the text you want
local text = "Intermission"
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = ""
wait()
end
wait(0.95)
end
local plrs = {}
for i, player in pairs(game.Players:GetPlayers()) do
if player then
table.insert(plrs, player) -- Add each player into players table
end
end
wait(1)
local AvailableMaps = MapsFolder:GetChildren()
local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)]
local fulltext = ChosenMap.Name.."" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = ""
wait()
end
wait(5)
for i = 10, 0, -1 do
local fulltext = "Players will be teleported in ("..i..")" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value =
wait()
end
wait(0.4)
end
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = workspace
wait(1)
--Teleport players to the map
local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")
if not SpawnPoints then
print("Spawn points not found!")
end
local AvailableSpawnPoints = SpawnPoints:GetChildren()
for i, player in pairs(plrs) do
if player then
character = player.character
if character then
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFrame + Vector3.new(0,10,0)
table.remove(AvailableSpawnPoints,1)
local Sword = ServerStorage.Sword:Clone()
Sword.Parent = player.Backpack
local GameTag = Instance.new("BoolValue")
GameTag.Name = "GameTag"
GameTag.Parent = player.Character
else
if not player then
table.remove(plrs,i)
end
end
end
end
if ClonedMap:FindFirstChild("SpawnPoints") then
ClonedMap.SpawnPoints:Destroy()
end
local fulltext = "Get Ready to Play!" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = text
wait()
end
wait(1)
for i = GameLength,0,-1 do
for x, player in pairs(plrs) do
if player then
character = player.Character
if not character then
-- Left the game
table.remove(plrs,x)
else
if character:FindFirstChild("GameTag") then
-- They are still alive
print(player.Name.." is still in the game!")
else
-- They are dead
table.remove(plrs,x)
print(player.Name.." has been removed!")
end
end
else
table.remove(plrs,x)
print(player.Name.." has been removed!")
end
end
local fulltext = ""..i.." seconds remaining" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = text
wait()
end
if #plrs == 1 then
-- Last person standing"The winner is "..plrs[1].Name
local fulltext = "The winner is "..plrs[1].Name -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = text
wait()
end
plrs[1].leaderstats.Wins.Value = plrs[1].leaderstats.Wins.Value + reward
wait(5)
break
elseif #plrs == 0 then
local fulltext = "Nobody won!" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = text
wait()
end
wait(3)
break
elseif i == 0 then
local fulltext = "Times up!" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = text
wait()
end
wait(3)
break
end
wait(1)
end
print("End of game")
for i, player in pairs(game.Players:GetPlayers()) do
character = player.Character
if not character then
-- Ignore them
else
if character:FindFirstChild("GameTag") then
character.GameTag:Destroy()
if player.Backpack:FindFirstChild("Sword") then
player.Backpack.Sword:Destroy()
end
if character:FindFirstChild("Sword") then
character.Sword:Destroy()
end
end
ClonedMap:Destroy()
player:LoadCharacter()
local fulltext = "Game Ended" -- change to the text you want
local text = ""
for i = 1,#fulltext do
text = fulltext:sub(1,i)
Status.Value = text
wait()
end
end
end
end
Local Script
local Status = game:GetService("ReplicatedStorage"):WaitForChild("Status") -- this will be used as a variable
script.Parent.Text = Status.Value -- this tells when it changes
Status:GetPropertyChangedSignal("Value"):Connect(function() -- and when it changes again this will be used
script.Parent.Text = Status.Value
end)
there you go

1 comment
On line 088 - Upercase the "c" in player.character! its supposed to be player Character. Try it and see if there are any changes!