I want to make a system that it chooses a random minigame and to teleport you to it.
It does chooses a random minigame, and another random teleporter. It says “We’ll be playing The Blue Obby”, and sometimes is telporting me right,and sometimes it teleporting me in the sky(where the blue teleporter is)
Here’s my Explorer:
script:
local status = game.ReplicatedStorage.Status
local maps = game.ReplicatedStorage.Maps:GetChildren()
while true do
for i = 1,10 do
status.Value = "Intermission: "..10-i
wait(1)
end
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = workspace
status.Value = "We'll be playing "..map.Name
local players = game.Players:GetChildren()
wait(4)
for i = 1,#players do
local spawnLocation = math.random(1,#workspace.Teleports:GetChildren())
players[i].Character:MoveTo(workspace.Teleports:GetChildren(status.Value)[spawnLocation].Position) -- there is the problem
players[i].Character.Parent = workspace.Ingame
end
local roundLenght = 50
local CanWin = true
if map:FindFirstChild("Obby") then
map.EndPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
CanWin = false
status.Value = hit.Parent.Name.." has won!"
end
end)
end
repeat
roundLenght = roundLenght -1
status.Value = "Time Left: "..roundLenght
wait(1)
until roundLenght == 0 or CanWin == false or #workspace.Ingame:GetChildren() == 0
wait(3)
map:Destroy()
end