so im creating a tree system kinda like lumber tycoon 2 trees, and i want to make it so they cant grow inside of other parts. i made a 25x25x25 region3 around the position where sappling is about to grow.
if it detects a part other than the part sappling will grow on, then it wont grow, heres the script
local region2 = Region3.new(pozycja - Vector3.new(moduledrzewa.dystansodscian,moduledrzewa.dystansodscian,moduledrzewa.dystansodscian),pozycja + Vector3.new(moduledrzewa.dystansodscian,moduledrzewa.dystansodscian,moduledrzewa.dystansodscian))
local parts2 = workspace:FindPartsInRegion3(region2)
local canGrow = true
if parts2 ~= nil then
for i,v in pairs(parts2) do
if v ~= wybranyPart then
canGrow = false
end
end
end
wybranyPart = the part sappling will grow on
pozycja = position where the sappling will grow