How to put a block to the sides of other blocks?
Hello!
I want to make a build tool to build anything. Basically, my tool works well... However, the blocks that I want to put doesn't appear on the sides of other blocks. Exactly, when I hover the mouse, for example, on the side of a pillar, then when I press the left mouse button, the block appears on pillar's top, and not where my mouse is or not on the side of the pillar.
Here's my localscript inside my tool:
02 | local rs = game:GetService( "ReplicatedStorage" ) |
05 | local BlockModule = require(rs.BlockModule) |
06 | local ImageModule = require(rs.ImageModule) |
07 | local WeldModule = require(rs.WeldModule) |
10 | local player = game:GetService( "Players" ).LocalPlayer |
11 | local mouse = player:GetMouse() |
13 | local tool = script.Parent |
15 | local function round(number,increment) |
16 | number = math.floor(number) |
17 | number = number-(number%increment) |
22 | tool.Equipped:Connect( function () |
23 | local placement = rs.Blocks:FindFirstChild( "Part" ):Clone() |
24 | placement.Anchored = true |
25 | placement.Transparency = 0.5 |
26 | placement.CanTouch = false |
27 | mouse.TargetFilter = placement |
29 | placementmodel = Instance.new( "Model" ,workspace) |
30 | placementmodel.Name = player.Name.. "'s placement" |
31 | placement.Parent = placementmodel |
32 | placementmodel.PrimaryPart = placement |
34 | movePlacement = game:GetService( "RunService" ).Stepped:Connect( function () |
35 | placementmodel:MoveTo(Vector 3. new(round(mouse.Hit.Position.X, 1 ),round(mouse.Hit.Position.Y, 1 ),round(mouse.Hit.Position.Z, 1 ))) |
38 | onMouseClick = mouse.Button 1 Down:Connect( function () |
39 | rs.Place:FireServer( "Part" , placementmodel.PrimaryPart.Position) |
42 | tool.Unequipped:Connect( function () |
43 | onMouseClick:Disconnect() |
44 | movePlacement:Disconnect() |
45 | placementmodel:Destroy() |
I hope I explained my problem clearly.