function tp_players(pos)
local target = pos
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
end
local Players = game:GetService("Players")
local winners = {}
function winners_setup()
winners = {}
Players.PlayerAdded:connect(function(player)
table.insert(winners, player.Name)
end)
Players.PlayerRemoving:connect(function(player)
for i,k in pairs(winners) do
if k == player.Name then
table.remove(winners, winners[i])
end
end
end)
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
for i,k in pairs(winners) do
if k == player.Name then
table.remove(winners, winners[i])
end
end
end)
end)
end)
end
function award_players()
for i,k in winners do
Players[k].leaderstats.wins = Players[k].leaderstats.wins + 1
Players[k].data_folder.coins = Players[k].data_folder.coins + 10
end
end
function before_start_counter(timer)
local Plrs = game:GetService("Players"):GetChildren()
local event = game:GetService("ReplicatedStorage").beginning
while wait(1) do
if timer > 0 then
timer = timer - 1
event:FireAllClients(timer)
else
event:FireAllClients(timer)
end
end
end
local replicatedStorage = game:GetService("ReplicatedStorage")
local timing_event = replicatedStorage.timing
local timerColor = "blue"
local counter = 30
local case = 1
function intermission()
case = 1
while wait(1) do
if counter > 0 then
counter = counter - 1
timing_event:FireAllClients(counter, case)
else
in_game()
winners_setup()
break
end
end
end
function in_game() -
counter = 120
case = 2
while wait(1) do
if counter > 0 then
counter = counter - 1
timing_event:FireAllClients(counter, case)
else
local target = CFrame.new(245.005, 2458.039, -1137.499)
tp_players(target)
intermission()
award_players()
break
end
end
end
local Players = game:GetService("Players")
local timing = workspace.timer
local timer
local status
timing.Event:Connect(function(counter, case)
timer = counter
status = case
if timer == 0 and status == 1 then
choosemap()
end
end)
local plrs = {}
Players.PlayerAdded:connect(function(player)
table.insert(plrs, player)
end)
Players.PlayerRemoving:connect(function(player)
for i,k in pairs(plrs) do
if k == player then
table.remove(plrs, plrs[i])
end
end
end)
local desert_votes = 2
local island_votes = 4
local obby_votes = 6
local list = {desert_votes, island_votes, obby_votes}
local games = {"desert", "island", "obby"}
function choosemap()
local value = 0
local index = 0
for i,k in pairs(list) do
if k > value then
index = i
end
end
if index == 0 then
load_desert()
end
if index == 1 then
load_island()
end
if index == 2 then
load_obby()
end
desert_votes = 0
island_votes = 0
obby_votes = 0
end
function load_desert()
local target = CFrame.new(-343.439, -423.722, 348.961)
tp_players(target)
end
function load_island()
end
function load_obby()
end
intermission()
wait(2)
load_desert()
I'm sorry for this big script, but I'm trying to find the problem for days and I'm not patient enough anymore. So, I want to call the function load_desert() which should teleport me somewhere, but it doesn't work. Not only the function but even if I put something after it still won't work. Why?

1 comment
I found out that there's a problem at intermission() but I can't figure it out.