Hi, I'm trying to create a little building system for me to experiment with. I've got the mouse and everything working, but for example when I move the 'ghost part' against the ground or against another part it kind of goes inside. Here is my code:
--this is just a test for the part preview
--i know i havent added anything for when you unequip the tool, ignore that please
--localscript
script.Parent.Equipped:Connect(function()
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local tool = script.Parent
local selectionpart = Instance.new("Part", game.Workspace.SelectionPart)
selectionpart.Anchored = true
selectionpart.CanCollide = false
selectionpart.Transparency = 0.5
selectionpart.CFrame = CFrame.new(mouse.Hit.Position)
mouse.TargetFilter = game.Workspace.SelectionPart
mouse.Move:Connect(function(p)
selectionpart.CFrame = CFrame.new(mouse.Hit.Position)
end)
end)
Another small question if it isn't too much, how would I also go about making the part move on an increment (e.g it only moves 1 stud) Thanks!

1 comment
Thanks for taking the time to answer, I'll try it out and also refer to the devforum post you linked at the bottom :)