I am trying to keep this smaller gui frame inside the larger one.
This is my current script which just lets the point go anywhere
local MousePos = UIS:GetMouseLocation() - Vector2.new(0, game:GetService("GuiService"):GetGuiInset().Y)
local X = (Input.Position.X - Frame.AbsolutePosition.X) / FRame.AbsoluteSize.X
local Y = (Input.Position.Y - Frame.AbsolutePosition.Y) / Frame.AbsoluteSize.Y
if ButtonDown then
Point.Position = UDim2.new(X,0,Y,0)
end
Ive tried other methods like this that somewhat does the job
local IsY = Frame.AbsolutePosition.Y <= MousePos.Y and MousePos.Y <= Frame.AbsolutePosition.Y + Frame.AbsoluteSize.Y
local IsX = Frame.AbsolutePosition.X <= MousePos.X and MousePos.X <= Framel.AbsolutePosition.X + Frame.AbsoluteSize.X
if IsY and IsX and ButtonDown then
Point.Position = UDim2.new(X,0,Y,0)
end
But the point can still “leak” out the frame
I know the solution will have to utilize math.clamp but I dont know exactly how to do that.
Thanks if you can help!