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
I managed to get it working through trial and error. Thanks for the help!