OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 23 Aug 2017 05:19 AM |
Hey, I am working on a placement system and I have an issue.
It works and all, but when I try to place on the Front and Left surfaces, it does not detect the placement there.
gyazo com/71d6fd7b597acfefd4be86b832c7b6fe
Here is the round function:
function round(step,number) return math.floor(number/step + 0.5)*step end
Here is the positioning:
ghost:SetPrimaryPartCFrame(CFrame.new(round(4,mouse.Hit.X),round(4,mouse.Hit.Y) + 2,round(4,mouse.Hit.Z)))
I don't get why it's happening?
|
|
|
| Report Abuse |
|
|
KapKing47
|
  |
| Joined: 09 Sep 2012 |
| Total Posts: 5522 |
|
|
| 23 Aug 2017 07:27 AM |
Is there any other code? I doubt this is to blame :/ Unless of course if the primary part of the model was offset to one side which could cause the whole model to be offset, which would in turn move the ghost part inside the existing part.
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 23 Aug 2017 07:47 AM |
script.Parent.test.MouseButton1Click:connect(function() local placed local mouse = player:GetMouse() local ghost = game.ReplicatedStorage.Block:Clone() for _,v in ipairs(ghost:GetChildren()) do v.Transparency = v.Name ~= "Main" and .5 or 1 end ghost.Parent = workspace.ignore mouse.TargetFilter = workspace.ignore moving = true local con con = mouse.Button1Down:connect(function() placed = true moving = false end) while moving do wait() local Surface = mouse.TargetSurface print(Surface) ghost:SetPrimaryPartCFrame(CFrame.new(round(4,mouse.Hit.X),round(4,mouse.Hit.Y) + 2,round(4,mouse.Hit.Z))) end con:disconnect() if placed then local block = game.ReplicatedStorage.Block:Clone() block.Parent = workspace block:SetPrimaryPartCFrame(CFrame.new(round(4,mouse.Hit.X),round(4,mouse.Hit.Y) + 2,round(4,mouse.Hit.Z))) ghost:Destroy() end end)
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 23 Aug 2017 08:51 AM |
bump, idk why its not working
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
| |
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
| |
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
| |
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
|
| 23 Aug 2017 11:40 AM |
try this: return math.floor(number/step + 0.5)*number
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 23 Aug 2017 12:38 PM |
Nope didn't work. That makes the block not even appear.
|
|
|
| Report Abuse |
|
|
KapKing47
|
  |
| Joined: 09 Sep 2012 |
| Total Posts: 5522 |
|
|
| 23 Aug 2017 02:02 PM |
Judging by the GIF I assume there is only 1 part to move?
|
|
|
| Report Abuse |
|
|