So i tried searching the wiki trying to figure this out but i cant find anything. Basically i am making an rbg color creator for random reasons And i dont want it to drag out side the frame so i am making and if statement that checks if the position is grater than the udim.
player = game.Players.LocalPlayer
mouse = player:GetMouse()
dragging = false
function drag()
while dragging == true do
if script.Parent.Position >= UDim2.new(0,255,0,0) then
print(34)
end
script.Parent.Position = UDim2.new(0,mouse.X - 225,0,0)
--[[^^^^^^^^^^^^^^^^^^dont worry about this i set it up so it puts the gui on the mouse]]
wait()
end
end
script.Parent.DragBegin:connect(function()
dragging = true
drag()
end)
script.Parent.DragStopped:connect(function()
dragging = fals
end)

3 comments
Turn Dragging (http://wiki.roblox.com/index.php?title=API:Class/GuiObject/Draggable) on.
ik that much but im trying to make it to were is dose not go out side a frame
Use AbsolutePosition and AbsoluteSize to compare Gui objects.