My script counts objects that are touching the surface of the hitbox as colliding, I researched for a solution but couldn’t find any devforum posts, etc. I don’t know how to approach this problem so some helpful advice would be appreciated!
Video:
Video showcasing issue
Script
Important part of script
local cframe = CFrame.new(newlocation) * newrotation
model:PivotTo(cframe)
local parttable = game.Workspace:GetPartBoundsInBox(model.WorldPivot, model.Hitbox.Size)
local found = false
for i,v in pairs(parttable) do
if v == game.Workspace.World.Baseplate then
found = true
end
end
if not found or #parttable > 1 then
highlight.FillColor = Color3.fromRGB(255, 11, 0)
else
highlight.FillColor = Color3.fromRGB(0, 237, 4)
end
Some extra information, the parts are on a grid (math.round) and only the surface is touching.