alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 02 Jul 2014 02:47 AM |
ok, so far I have this script, and It places bricks, correctly, but not so correctly. It doesnt place them according to studs or anything, how would you make it so the brick gets places to the nearest stud?:
mouse = game.Players.LocalPlayer:GetMouse() player = game.Players.LocalPlayer faik = Instance.new("Part", player.Character.Humanoid)
mouse.Move:connect(function() faik.Position = mouse.hit.p faik.Anchored = true faik.CanCollide = false faik.Name = "Fake" end)
mouse.Button1Down:connect( function() fake = player.Character.Humanoid:findFirstChild("Fake") if fake~=nil then b = Instance.new("Part", player.Character.Humanoid) b.Position = fake.Position b.Anchored = true end end) |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2014 04:53 AM |
function toStudGrid(vector) local x,y,z = vector.X,vector.Y,vector.Z return Vector3.new(math.floor(x),math.floor(y),math.floor(z)) end
Just run that function on the position For instance:
local testVector = Vector3.new(1.5,1.5,1.5) print(toStudGrid(testVector)) -- Should Print 1, 1, 1 |
|
|
| Report Abuse |
|
|