I tried to make a function that detects collision, but it is faulty. Could someone please make it better?
function withingui(gui,position)
if
position.X.Offset >= gui.Position.X.Offset and
position.X.Offset <= gui.Position.X.Offset+gui.Position.X.Offset and
position.Y.Offset >= gui.Position.Y.Offset and
position.Y.Offset <= gui.Position.Y.Offset+gui.Position.Y.Offset
then
print("Intersecting")
return true
else
return false
end
end
