Ok, so i have a round script (I cut out the parts irrelevant to teleporting, like equipping the player) and before the round starts it is supposed to teleport the players to a random spawn point on the map (downwards of the lobby).
pos1 = Vector3.new(game.ServerStorage.spawns.spawn1.Position) pos2 = Vector3.new(game.ServerStorage.spawns.spawn2.Position) pos3 = Vector3.new(game.ServerStorage.spawns.spawn3.Position) pos4 = Vector3.new(game.ServerStorage.spawns.spawn4.Position) pos5 = Vector3.new(game.ServerStorage.spawns.spawn5.Position) pos6 = Vector3.new(game.ServerStorage.spawns.spawn6.Position) positions = {pos1,pos2,pos3,pos4,pos5,pos6} TIME = 30 -- default hint = game.Workspace.Hint maps = game.ServerStorage.maps:GetChildren() while true do while true do wait(1) hint.Text = "The round starts in "..tostring(TIME).." seconds..." TIME = TIME - 1 if TIME == 0 then hint.Text = "Picking and loading map..." wait(3) picked = maps[math.random(1,#maps)] hint.Text = "Chosen map is "..picked.Name..". Get ready." wait(3) clone = picked:Clone() clone.Parent = workspace plrs = game.Players:GetChildren() TIME = 60 wait(1) break end end --teleport players here for i,v in pairs(plrs) do print("equipping and teleporting") equip(v) ran = positions[math.random(1,#positions)] v.character.Torso.CFrame = CFrame.new(ran) end --stops teleporting players and starts round. while true do wait(1) hint.Text = "Fight! The round ends in "..tostring(TIME).." seconds..." TIME = TIME - 1 if TIME == 0 then hint.Text = "Round ending and teleporting players back..." clone:Destroy() wait(3) break end end TIME = 30 end
I haven't added a teleport back function yet because the script messes up while teleporting the player to one of the spawn positions. Instead of putting each player in the random selected spot the script teleports me to the East of the lobby, the wrong way from the downwards spot on the map. I've messed around with it some and can't seem to find the cause of this, it would lovely if someone can help because my little knowledge about Roblox CFrame.