how to do placement like in build a boat for treasure, not colliding into other parts
local blockView:Model=nil
function unequipped()
if newUi then
newUi:Destroy()
end
equipped=false
if blockView then
blockView:Destroy()
end
end
function mouseRaycast(blacklist)
local params=RaycastParams.new()
params.FilterType=Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances=blacklist or {character}
local ray=camera:ScreenPointToRay(mouse.X,mouse.Y)
local raycast=workspace:Raycast(ray.Origin,ray.Direction*1000,params)
return raycast
end
tool.Equipped:Connect(function()
newUi=ui:Clone()
newUi.Parent=plrUi
equipped=true
end)
tool.Unequipped:Connect(unequipped)
humanoid.Died:Connect(unequipped)
character.Destroying:Connect(unequipped)
runService.RenderStepped:Connect(function()
if equipped and blockView then
local result=mouseRaycast({blockView,character})
if result then
local pos=CFrame.new(result.Position)
pos+=Vector3.new(0,blockView.PrimaryPart.Size.Y/2,0)
blockView:PivotTo(pos)
end
elseif equipped then
blockView=blocks[selectedBlock]:Clone()
blockView.Parent=camera
end
end)```