Greetings, I’ve made a money printer placement system however I am not all too pleased with it. It hinges on mousePosition thus it clips into walls as you can see in the video
I want to prevent it clipping into walls but I am not sure how I would go about making that happen
here’s the script
tool.Equipped:Connect(function()
Targeting = true
Area = TargetArea:Clone()
Area.Parent = workspace
Area.CanCollide = false
Area.Anchored = true
mouse.TargetFilter = Area
while Targeting do
local minDist = 5
local MaxDist = 10
local mag = (mouse.Hit.p - Root.Position).Magnitude
if mag < minDist or mag > MaxDist then
Area.Transparency = 1
Area.Position = mouse.Hit.p + Vector3.new(0,.5,0)
else
Area.Transparency = 0.9
Area.Position = mouse.Hit.p + Vector3.new(0,.5,0)
end
wait(0.1)
end
end)
Please advise, and thank you for your time