When I run the game on Roblox studio it crashes. The script is suppose to get a random number and spawn a different part at a random position on the map.
while true do
local zposition = math.random(64, 64)
local xposition = math.random(64, 64)
local yposition = 1
local number = math.random(1,2)
if number == 1 then Part1 = game.ServerStorage.Part1:Clone()
Part1.PrimaryPart.Position = Vector3.new(zposition, xposition, yposition)
if number == 2 then local number2 = math.random(1,2)
if number2 == 1 then Part2 = game.ServerStorage.Part2:Clone()
Part2.PrimaryPart.Position = Vector3.new(zposition, xposition, yposition)
if number2 == 2 then Part3 = game.ServerStorage.Part3:Clone()
Part3.PrimaryPart.Position = Vector3.new(zposition, xposition, yposition)
wait(1)
end
end
end
end
end

2 comments
Try adding a wait to the loop
I've added a wait after the code but Ill try adding one before