|
| 18 Jun 2017 09:38 AM |
What is needed to make a placing system like in Plaza, Miners Haven, etc?
bamboozled |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2017 09:51 AM |
>Mouse's position >RenderStepped >Object |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Jun 2017 10:10 AM |
One more thing.
You need to set the mouse's targetfilter to the part which you want to follow the mouse. |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2017 10:12 AM |
Already did this and it works
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local run = game:GetService("RunService") local part = workspace.Part local placing = true
run.RenderStepped:connect(function() if placing == true then if mouse.Target ~= part then part.CFrame = mouse.Hit part.Orientation = Vector3.new(0, 0, 0) part.CanCollide = false part.Transparency = .5 end end end)
mouse.Button1Down:connect(function() mouse.Button1Up:connect(function() placing = false part.CanCollide = true part.Transparency = 0 end) end)
I was also trying to find how would I keep the Y position above the ground but the wiki always told me that Y values are readonly :/
bamboozled |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2017 10:16 AM |
You can set the Y like this.
part.CFrame=CFrame.new(mouse.Hit.x,1,mouse.Hit.p.z) |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2017 10:16 AM |
| 1 is the y axis aka the vertical axis. |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2017 10:18 AM |
Thank you so much
bamboozled |
|
|
| Report Abuse |
|
|
kojocrash
|
  |
| Joined: 07 Sep 2013 |
| Total Posts: 277 |
|
|
| 18 Jun 2017 10:19 AM |
To change the Y axis you need to do Part.Position = Part.Position + Vector3.new(0,y,0) To set it, it would be Part.Position = Vector3.new(Part.Position.X,0,Part.Position.Z)
Also you might need :SetPrimaryPartCFrame() or something like that |
|
|
| Report Abuse |
|
|
kojocrash
|
  |
| Joined: 07 Sep 2013 |
| Total Posts: 277 |
|
|
| 18 Jun 2017 10:20 AM |
| Or you can replace the Part.Position(The ones after the equal signs) with mouse.Hit.p |
|
|
| Report Abuse |
|
|