Below is my current code. I'm able to get a boolean value if textLabel1 and textLabel2 collide but how would i run this code so that it checks all possible combinations? e.g textlabel 1 and textlabel 3
Thanks for any help
local function getPos(object)
local posX = object.Position.X.Offset
local posY = object.Position.Y.Offset
return UDim2.new(0, posX, 0, posY)
end
local function getSize(object)
local sizeX = object.Size.X.Offset
local sizeY = object.Size.Y.Offset
return UDim2.new(0, sizeX, 0, sizeY)
end
--[[
local function checkForCollisions(object,object2)
if math.abs(object.Size.X.Offset + object2.Size.X.Offset)/2 >= math.abs(object2.Position.X.Offset - object.Position.X.Offset) and
math.abs(object.Size.Y.Offset + object2.Size.Y.Offset)/2 >= math.abs(object2.Position.Y.Offset - object.Position.Y.Offset) then
return true
else
return false
end
end
--]]
while true do
for i, v in pairs(script.Parent.Buttons:getChildren()) do
v.Changed:connect(function(property)
print(i..": "..tostring(getPos(v)).." "..tostring(getSize(v)))
end)
end
--[[
if checkForCollisions then
checkForCollisions[1].Style = "RobloxButton"
checkForCollisions[2].Style = "RobloxButton"
else
checkForCollisions[1].Style = "Custom"
checkForCollisions[2].Style = "Custom"
end
checkForCollisions(script.Parent.Buttons.TextButton, script.Parent.Buttons.TextButton2)
--]]
wait(1)
end

1 comment
Thanks dude, just wish you posted this an hour ago ;p