Since I was not clear enough about the previous post, I have reposted this question. I have attempted at making a script like this various times, but not once successful. How would I do this? I am not asking for a script, but a function that would aid me in making a script as such.
Oh, glorious for loops.
for x=1, 10 do -- Edit this to your needs for y=1, 10 do -- This too local p = Instance.new("Part", workspace) p.Anchored = true p.FormFactor = "Custom" p.Size = Vector3.new(.5, .5, .5) p.Position = Vector3.new(x, y, 0) -- Possibly this also wait() end end
You can extend the grid to 3d space like so:
for x=1, 10 do for y=1, 10 do for z=1, 10 do local p = Instance.new("Part", workspace) p.Anchored = true p.FormFactor = "Custom" p.Size = Vector3.new(.5, .5, .5) p.Position = Vector3.new(x, y, z) end end end
PLEASE NOTE that the wait() will majorly slow down loading times on large-scale operations. It is perfectly safe to remove the wait(), however users will experience either a freeze, or some minor lag.
I encountered this problem a few days ago, and it was by (almost) complete accident that I discovered the solution. I was actually researching something else when I saw the math.floor() (function? method? whatever you want to call it) I stuck this code inside a mouse.Moved function to great results.
position = mouse.Hit.p posX = math.floor(position.X) posY = position.Y posZ = math.floor(position.Z) endX = math.floor((posX/10)) * 10 endZ = math.floor((posZ/10)) * 10
Combined with a script to place blocks (I'm assuming you don't want to use mine) this will align placed blocks in a 10x10 grid arrangement. You can probably nest the math.floor()s, but I didn't bother for reasons that only make sense to me :3
Anyway I hope this helps, and if you (for some reason) do want my block placing script I would be happy to give it to you. (Although my script does need to be changed to a raycasting method)