Someone please help me, its teleporting the players to the game and it wont work? heres my script local mapsFolder = game.ReplicatedStorage:WaitForChild("Maps") local status = game.ReplicatedStorage:WaitForChild("Status")
while true do status.Value = "Intermission! 15"
local interTime = 15
repeat wait()
wait(1)
interTime = interTime -1
status.Value = "Intermission! "..interTime
until interTime <= 0
wait(1)
status.Value = "Selecting a map..."
local mapId = math.random(1,#mapsFolder:GetChildren())
local map = mapsFolder:FindFirstChild("Map"..mapId)
wait(2)
if map then
status.Value = "Map has been chosen!"
local mapName = map:FindFirstChild("MapName")
if mapName then
status.Value = "The map is "..mapName.Value
else
status.Value = "The map doesnt have a name."
end
wait(3)
status.Value = "Loading map..."
local newMap
newMap = map:Clone()
newMap.Parent = workspace
newMap.Name = "Map"
wait(2)
status.Value = "Teleporting players..."
if newMap:FindFirstChild("Spawns") then
for i,v in pairs(game.Players:GetPlayers()) do
local character = workspace:FindFirstChild(v.Name)
if character then
local rootPart = character:FindFirstChild("HumanoidRootPart")
if rootPart then
local spawnId = math.random(1,#newMap.Spawns:GetChildren())
local spawnObj = newMap.Spawns:FindFirstChild("Spawn"..spawnId)
if spawnObj then
rootPart.Position = spawnObj.Position
end
end
end
end
wait(2)
else
status.Value = "Map doesnt have spawns!"
end
else
status.Value = "Failed to find a map."
end
if workspace:FindFirstChild("Map") then
workspace.Map:Destroy()
end
wait(2)
end
someone please help me :)
