I'm having some trouble with a teleportation script. I'm using the CFrame.new method to teleport players to random parts of the map.
for i = 10,0,-1 do
timeText.Text = "Next round in: "..i
wait(1)
if i == 0 then
timeText.Text = "Choosing map..."
wait(1)
Maps = game.ServerStorage.Maps:GetChildren()
Map = Maps[math.random(1,#Maps)]:Clone()
Map.Parent = game.workspace
timeText.Text = "Map chosen: "..Map.MapName.Value.." by "..Map.MapCreator.Value.."."
wait(2)
timeText.Visible = false
TeleportPart = Map.TeleportPart
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.Torso.CFrame = TeleportPart + Vector3.new[math.random(TeleportPart.Position)]
end
end
end
end
This is what I got in the output:
14:52:45.961 - Players.Player1.PlayerGui.Intermission.LocalScript:29: bad argument #1 to 'random' (number expected, got Vector3)>
EDIT: Added the entire script

1 comment
Line 15 on here is your problem. You can't give math.random a position.