GetRandomPositionInsideFrame()

This function is basically a version of this GetRandomPositionInsidePart(), but for GUI objects

local function GetRandomPositionInsideFrame(MainFrame,OtherFrame)
	local x=Random.new():NextNumber(OtherFrame.Size.X.Scale/2,(MainFrame.Size.X.Scale - (OtherFrame.Size.X.Scale/2)))
	local y=Random.new():NextNumber(OtherFrame.Size.Y.Scale/2,(MainFrame.Size.Y.Scale - (OtherFrame.Size.Y.Scale/2)))
	return x, y
end
2 Likes

I recommend using AbsoluteSize instead since Scale can be 0 for a GuiObject

3 Likes