So I have defined local buildings
succesfully to children of a folder but the problem I'm having is that a for i = 1,#buildings do
loop goes through every building of the folders building[i]
and I'm trying to compare the CFrame of the building[i]
and the CFrame of the player's HumanoidRootPart. The CFrame of the building[i]
should be smaller than HumanoidRootPart.CFrame * CFrame.new(0,0,-10)
. So the Z part of the CFrame of the building[i]
should be smaller.
But the thing what I'm trying to do is that it checks is the building[i]
behind or in front of the player's HumanoidRootPart
.
Help highly appreciated !!!
something like this should work:
if buildings[i].Position.Z > HumanoidRootPart.Position.Z then print'in front' else print'behind' end
however, that is not the best way to do that.