I’m attempting to create a draggable frame, that consists of 2 frames (parents), but it doesn’t seem to render as intended and tends to lose the mouse’s position as moved furthermore. I was messing around with the AnchorPoint property, it doesn’t seem to cooperate with the code, alongside the code itself may be malfunctioning. I’ve researched similar issues with this for an hour, tried their solutions, but it kept giving me different bugs. Is there a method to create a smooth, draggable frame?
Concurrent Properties —
AnchorPoint is set to 0, 0
Dragobject is in the frame (mouse listener)
The frame is in 2 parents (MainFrame - Holders - DonateHolder)
local donateHeld = false; local dragDonate = donateH.Drag
dragDonate.MouseButton1Down:Connect(function()
donateHeld = true
end)
mouse.Move:Connect(function()
if donateHeld then
donateH.Position = UDim2.new(0, mouse.X, 0, mouse.Y) + (UDim2.fromOffset(mouse.X, mouse.Y) - donateH.Position)
--malfunction is in the line above.
end
end)
dragDonate.MouseButton1Up:Connect(function()
donateHeld = false
end)
The script works better, however, the downside of it is that the cursor only targets the specific position, rather than moving it to its original position. Is there anything that I’ve missed, or would be extra? https://gyazo.com/fe605b08d2f498c8785b82f4a17fa63f
The AnchorPoint, for the frame, determines the exact position the cursor should target to. I’m unsure about the TextButton though.
Of course! I was thinking of that idea but didn’t acknowledge where to start - this is one of the best solutions, thank you for the generosity! I’ll update the post and mark your solution.