generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Building brick

Previous Thread :: Next Thread 
alij12 is not online. 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
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image