so i have a block placement system, but when the preview happens, it keeps flashing for some reason.
this is the part where it gets a part with a selection box, the part is invisible.
local part = game.Workspace:FindFirstChild("Select") or game.ReplicatedStorage.Select:Clone()
and this is the placement of the preview
mouse.Move:Connect(function()
if equipped == true then
print("moved")
local target = mouse.Target
if target then
local surface = mouse.TargetSurface
local pos = Surface(surface)
mouse.TargetFilter = part
local x = mouse.Hit.X
local y = mouse.Hit.Y
local z = mouse.Hit.Z
part.Position = pos + target.Position
end
--Vector3.new(math.floor(x/4) * 4, math.floor(y/4) * 4 + 2, math.floor(z/4) * 4)
end
end)
(pos is just adding numbers based on the face the mouse is on)
it flashes sometimes but dosn’t other, seems to work when character is far away but flashes when near, it has flashed when being far away too, looks very random.
If you mean you have 2 identical sized Parts at the same location (one Part, one preview Part) then you’ll get what’s called z fighting. The computer can’t tell which of the 2 surfaces that face the camera is closer, so it tries to render both at the same time.
Try making the preview Part .01 studs larger in all 3 dimensions and semi-transparent so both can be seen, but the surfaces won’t be at the exact same spot.
What is the script for the placement and deletion of the preview Part?
The game shows me a split second view of the preview when I drag the mouse across the wood Part, but it doesn’t stay in view at all.
Is the script sensing the preview box as a non-target and removing the preview instantly?
I know there have been other posts about block placement grid problems in other posts. You may find some answers if you search the forum.