So lately I have been working on a game of mine and to save lag when a player deletes a block it will fill a block all around the to hide the view of the void but I got an issue it only works if I delete the block below me and if I delete the block in any other direction the script places a block into my character and I know how to fix it I just don’t know how to achieve it this is my script so far.
DeleteEvent.OnServerEvent:Connect(function(plr, BlockPosition)
for i, Part in pairs(BlockGeneratedFolder:GetChildren()) do
if Part.Position == BlockPosition then
local PointsTable = {
Part.CFrame.LookVector,
Part.CFrame.RightVector,
Part.CFrame.LookVector * -1,
Part.CFrame.RightVector * -1,
Part.CFrame.UpVector * -1
}
for i = 1, 5, 1 do
local ray1 = workspace:Raycast(Part.Position + PointsTable[i], PointsTable[i])
if not (ray1) then
BlockModule.CreateFillBlock(Part.Position + PointsTable[i]*3, GenerationObjectFolder, BlockGeneratedFolder)
end
end
Part:Destroy()
end
end
end)
All I need it to do is check what look vector the player clicked and ignore that in the loop.
What I mean is I want it to ray cast every vector expect the vector the player clicked if that makes sense.
Thanks for any help