so i have this script which Teleports people to diffrent places on the map when the game starts im trying to make it so i have a math.random(8) and if its a certain number you get teleported to a diffrent place on the map. In conclusion how do you store math.random data in variables?heres the code. But for some reason it doesnt run the code inside the Get Players Code. It doesnt even print Works
Players = game:GetService("Players")
for i, player in pairs(Players:GetPlayers()) do
Number = math.random(1,8)
if Number == 1 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-30.13, 0.5, 33.825))
print("Works")
end
if Number == 2 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(99.37, 0.5, 32.825))
print("Works")
end
if Number == 3 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(97.37, 0.5, 164.325))
print("Works")
end
if Number == 4 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-32.63, 0.5, 169.825))
print("Works")
end
if Number == 5 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-29.63, 0.5, 93.325))
print("Works")
end
if Number == 6 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(38.87, 0.5, 36.825))
print("Works")
end
if Number == 7 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(38.87, 0.5, 36.825))
print("Works")
end
if Number == 8 then
game.Workspace[player.Name].HumanoidRootPart.CFrame = CFrame.new(Vector3.new(95.37, 0.5, 101.825))
print("Works")
end
end

3 comments
Why not just make parts and teleport the player to the specified part? This way you dont have to do a bunch of variables and you can have cleaner code.
Wait thats not it i want a bunch of players teleport to random places on the map its a serverside code
Basically if i do local Number = math.random(8) print(Number) thats what i want to do