Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Detecting if a Frame's Position(x) is at a specific position?

So I'm making this Tug o' war minigame for my 2D Gui and I have encountered my first problem. I'm trying to make it so if middle of my rope (which is also a frame) hits the left or right side of the Gui (which are also Frame's); and I don't exactly know on how to do this.. I tried

if script.Parent.left.MIDDLE.Position.X>=script.Parent.Parent.right.Position.X then
				print(script.Parent.Parent.Parent.Parent.Parent.Name.." wins!")
			end

Keep in mind that I just started to learn on how to script Gui's.. help would be appreciated ;)

2 answers

GUIs don't have normal position like parts, instead of using Vector3 use UDim2. For example:

Frame.Position = UDim2.new(0,50,0,50)

So try this:

if script.Parent.left.MIDDLE.Position.X.Offset>=script.Parent.Parent.right.Position.X.Offset then
                print(script.Parent.Parent.Parent.Parent.Parent.Name.." wins!")
            end

You need to edit this.


Hope it helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.