#Why isn't the text button centered on the mouse cursor?

1 messages · Page 1 of 1 (latest)

native sluice
#

Here code

local mouseDownConn = slotGui.Base.MouseButton1Down:Connect(function(x, y)
if BackpackFrame.Visible then

        slotGui.Base.Position = UDim2.new(
            0, x,
            
            0, y
        )
        
        DragConnection = mouse.Move:Connect(function()
            local newPos = Vector2.new(mouse.X, mouse.Y)
            
            slotGui.Base.Position = UDim2.new(
                0, newPos.X,
                
                0, newPos.Y
            )
        end)
    end
end)
#

When I click and try to move it, the textbutton simply gains a large displacement of the mouse.

onyx spire
#
native sluice
#

oh

#

HM let me see it

sharp adder
#

set the anchor point to 0.5, 0.5

native sluice
#

i finally solve the problem!

#

the problem was the textbutton position is relative to parent size

haughty wrenBOT
#

studio** You are now Level 4! **studio

native sluice
#

soo what i did was create fully screen frame {1, 0, 1, 0} and change the parent of the textbutton to Frame

#

Here's the code in case anyone else has the same problem.