https://gyazo.com/1ff66c6050247a57a9cbb1f938825e29
The trees and the market all have a hitbox, when they touch the market should turn red however it dosnt.
https://gyazo.com/5f7bcb99fb66a4b0ae08dc8da5282e80 However with a tent/smaller building the same exact system works fine
and heres the script
part.Position + 0.5 * part.Size
does not work for all rotations, cause part.Size
is a vector that lives in the object space of part.CFrame
. part.Position + 0.5 * part.CFrame:VectorToWorldSpace(part.Size)
is probably what you were trying to accomplish. You can find more information about this in Object and World Space | Roblox Creator Documentation.
Also, using WorldRoot | Roblox Creator Documentation is probably more logical than the for loop you used.
local foundParts = workspace:FindPartsWithIgnoreList(region, ignoreList, 1)
local makeRed = (foundParts > 0)
That is correct. My fix is incomplete and only works for 4 (straight) rotations, but you will still need to convert part.Size
to a world space vector.