When Resizeing a GUI it jumps weirdly

when i drag the plus it jumps downwards

idk why is does this is it a issue with my screen

heres the code

wait(1)
local App = script.Parent
local Window = App.Window
local Over = App.Overlay

Window.Drag.MouseButton1Down:connect(function()
	Over.Visible = true
	local Move = Over.MouseMoved:connect(function(X,Y)
		local x = X-Window.AbsolutePosition.X-(Window.Drag.Size.X.Offset/2)
		local y = math.floor(((Y-(Window.Drag.Size.Y.Offset/2))/20)+0.5)*20
		if x < 400 then x = 400 end
		if y < 100 then y = 100 end
		Window.Size = UDim2.new(0,x,0,y)
	end)
	local Up
	local Leave
	Up = Over.MouseButton1Up:connect(function()
		Move:disconnect()
		Up:disconnect()
		Leave:disconnect()
		Over.Visible = false
	end)
	Leave = Over.MouseLeave:connect(function()
		Move:disconnect()
		Up:disconnect()
		Leave:disconnect()
		Over.Visible = false
	end)
end)

I has to do maybe with the anchor points of the gui, try fixing those

all the AnchorPoints are 0, 0 so should i change them to somthing else

ok i fixed it by subtracting they y value by 13.6 so it will stay on the cursor

wait(1)
local App = script.Parent
local Window = App.Window
local Over = App.Overlay

Window.Drag.MouseButton1Down:connect(function()
	Over.Visible = true
	local Move = Over.MouseMoved:connect(function(X,Y)
		local x = X-Window.AbsolutePosition.X-(Window.Drag.Size.X.Offset/2)+10
		local y = math.floor(((Y-(Window.Drag.Size.Y.Offset/2))/20)-13.6)*20
		if x < 400 then x = 400 end
		if y < 100 then y = 100 end
		Window.Size = UDim2.new(0,x,0,y)
	end)
	local Up
	local Leave
	Up = Over.MouseButton1Up:connect(function()
		Move:disconnect()
		Up:disconnect()
		Leave:disconnect()
		Over.Visible = false
	end)
	Leave = Over.MouseLeave:connect(function()
		Move:disconnect()
		Up:disconnect()
		Leave:disconnect()
		Over.Visible = false
	end)
end)

so if anyone else is having this problem here is the code and all you do is subtracting or adding till it looks nice

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.