Hi.
-
What do you want to achieve? I am trying to make a script that will tell whether two screen gui
Image Buttons
are touching. -
What is the issue? My script doesn’t seem to be working.
My script so far (It doesn't work)
local gui = script.Parent.Parent
local frame = script.Parent.Parent.Parent.FakeFrame
local distance = nil
while true do
distance = math.abs((gui.AbsolutePosition - frame.AbsolutePosition).Magnitude)
if distance > (frame.AbsoluteSize.X / 2) then
script.Parent.Value = false
else
script.Parent.Value = true
end
print(distance)
wait(.1)
end
The script prints out 0
and there are no errors.
The Explorer:
Note: I am trying to make sure that the object called slider
stays inside the element called FakeFrame
.
-
What solutions have you tried so far? I searched on the Developer Forum, but I couldn’t find anything. I tried using
.Magnitude
with.AbsoluteSize
, but it didn’t work.
Please tell me if you have any questions about this post!
Edit: Not sure of this helps, but both the Image Buttons
have an Anchor Point
of (0, 0.5)
Edit 2: While playing around with it, I changed both their anchor points to (0.5, 0.5)
and now all it prints out is 28.799987792969