Making a build system, and I would like it to function similarly to 'classic' build tools, where the object would not clip through any other part. How would I do this?
Ok I tried my code and it did not work. The solution is to create a model containing just the part (the part has to be the primary part). Use a function called MoveTo()
which takes a vector3 value inside of it. Example
01 | -- Example |
02 |
03 | local Model = Instance.new( "Model" , workspace) |
04 |
05 | local Part = Instance.new( "Part" ) |
06 | Part.Anchored = true |
07 | Part.Parent = game.Workspace.Model |
08 |
09 | Model.PrimaryPart = Part |
10 |
11 | local Player = game.Players.LocalPlayer |
12 | local Mouse = Player:GetMouse() |
13 |
14 | local function MovePart() |
15 | Mouse.TargetFilter = Part -- Ignores the part |
16 |
17 | Model:MoveTo(Vector 3. new(Mouse.Hit.X, Mouse.Hit.Y, Mouse.Hit.Z)) -- Not using CFrames |
18 | end |
19 |
20 | Mouse.Move:Connect(MovePart) |
Hope this works!