while true do local y = math.random(21,25) local x = math.random(-227.7,-222.2) local z = math.random(0,5.2) s = Instance.new("Part") s.Parent = Workspace s.Size = 1,1,1 s.TopSurface = 1 s.BottomSurface = 1 s.BrickColor = BrickColor.new("Bright blue") s.Anchored = true s.CanCollide = false s.Position = Vector3.new(x,y,z) s.Name = Part s:remove() wait(1) end
Whenever I run or play solo, it does not create any parts at all. Nothing happens.
1 s.Size = Vector3.new(1,1,1)
It won't understand how big the block should be so...... It can't create it!
Please include any output you got. Here, it's easy to see the problem, but you still should have included the output.
Size is a vector3 value. Therefore, s.Size = Vector3.new(1,1,1)
Here's a fixed version of your script.
while true do y = math.random(210,250)/10 x = math.random(-2277,-2222/10)/10 z = math.random(0,52)/10 s = Instance.new("Part") s.Parent = Workspace s.Size = Vector3.new(1,1,1) s.TopSurface = "Smooth" s.BottomSurface = "Smooth" s.BrickColor = BrickColor.new("Bright blue") s.Anchored = true s.CanCollide = false s.CFrame = CFrame.new(x,y,z) s.Name = "Part" wait(1) s:Destroy() end
As to my knowledge, you can't look up decimals with math.random, unless you divide it by something. I changed TopSurface and BottomSurface to smooth. s.Name needs "" around the name, also it's named Part by default. You had the wait(1) after the s.remove(), which I changed to destroy(). Size needed to be a Vector3 with () and instead of position, I used CFrame.
Instance.new("Part",Workspace)
while true do local y = math.random(21,25) local x = math.random(-227.7,-222.2) local z = math.random(0,5.2) s = Instance.new("Part") s.Parent = game.Workspace s.Size = Vector3.new(1,1,1) s.TopSurface = 1 s.BottomSurface = 1 s.BrickColor = BrickColor.new("Bright blue") s.Anchored = true s.CanCollide = false s.Position = Vector3.new(x,y,z) s.Name = "Part" s:remove() wait(1) end