Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I'm struggling to make my GUIs draggable. Can anyone help?

Asked by
CoMeZz 5
5 years ago

Im working on a few GUIs and im struggling to actually make them draggable due to the new update. Can anyone help?

0
you can still set gui's to draggable via script, although most people prefer to make their own systems Gey4Jesus69 2705 — 5y
0
Draggable is deprecated and it wasn't even working properly. User#24403 69 — 5y
0
what kind of guis are you working with? SteamG00B 1633 — 5y
0
actually just found this link that might be able to help you out, it has an example on it: https://devforum.roblox.com/t/draggable-property-is-hidden-on-gui-objects/107689/5 SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by
zblox164 531 Moderation Voter
5 years ago
Edited 5 years ago

Try this

local runService = game:GetService("RunService)

local mouse = game.Players.LocalPlayer:GetMouse()

local isDown = false

local function MoveUI()
    if isDown then
        script.Parent.Position = UDim2.new(0, (mouse.X), 0, mouse.Y) -- moves the UI
    end
end

mouse.Button1Down:Connect(function()
    isDown = true -- Switch to true
end)

mouse.Button1Up:Connect(function()
    isDown = false -- Switch to false
end)

runService:BindToRenderStep("Input", Enum.RenderPriority.Input.Value, MoveUI) -- Calls the function

This should would but you may have to subtract of add a value to the Y position to center it on your mouse.

Untested by the way. Hope this helps!

Ad

Answer this question