|
| 06 Feb 2015 05:33 PM |
I'm trying to make it so that way it creates a new brick and puts the bricks position to where the mouse is, and it ain't working!
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local part = Instance.new("Part", game.Workspace) part.FormFactor = "Custom" part.Size = Vector3.new(2,0.4,2) part.BrickColor = BrickColor.new("Lime Green") while true do part.CoordinateFrame = CFrame.new(mouse.Hit) wait() end |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 05:38 PM |
Replace while true do part.CoordinateFrame = CFrame.new(mouse.Hit) wait() end
with
mouse.Move:connect(function() if mouse.Hit~=nil then part.CFrame=mouse.Hit end end)
Remember, Part's use CFrame, not CoordinateFrame. CoordinateFrame's are for the Camera's, which is the same as CFrame but is used for the Camera only. I removed your loop because the "Move" connection may quantify your script by giving it a faster response than the infinite loop that delays by .03 |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 05:58 PM |
| Okay, it works, but the brick faces the camera and I don't want that. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 06:01 PM |
Now you need to play around with the CFrame. View the CFrame category in the wiki and come up with your solution.
http://wiki.roblox.com/index.php?title=CFrame |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 06:03 PM |
| I attempted to use CFrame.Angles when I just posted that reply. It really doesn't fix it and it just moves the brick towards the camera. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 06:08 PM |
I just attempted to use this line
part.CFrame = CFrame.new(mouse.Hit.p)
This seems to fix the rotation problem, but the brick still goes towards the camera. Now I don't know how to solve it from here. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 06:15 PM |
Not efficient, but it should work. part.CFrame=CFrame.new(mouse.Hit.X,(mouse.Hit.Y+(part.Size.Y*5)),mouse.Hit.Z) |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 06:22 PM |
Good, don't like how it hovers, but good enough.
I added this at the end because if the person dies, a new brick is created and the old one will stay there forever.
human.Died:connect(function() part:Destroy() end) |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 06 Feb 2015 06:23 PM |
check the parts position/cframe? round it to the next .5?
example if the position is 4.324234324, 1, -3.65 then
round it to 4.5, 1, -3.5
and then make it's rotation rounded to the nearest 90 mark? example:
-180, 0, -180
90, 0, 0
0,0,0
180, 0, 180 |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 06 Feb 2015 06:23 PM |
| that should snap it to the stud grid |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2015 07:15 PM |
all that remains as an issue is make it so that way the brick doesn't go towards the camera, junior's code works most of the time except from an above view, I just want it so it doesn't go towards the camera (Such as the mouse being on the part and then it move the part up, the mouse is still on it and it goes up more. This goes in a loop until the brick goes behind the camera)
Take the green disc from older roblox (If anyone remembers it). The disc acts similar to this script, except it doesn't fly off towards the camera, how did they do that? |
|
|
| Report Abuse |
|
|