Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

4 comments

0

you can still set gui's to draggable via script, although most people prefer to make their own systems

0

Draggable is deprecated and it wasn't even working properly.

0

what kind of guis are you working with?

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

1 answer

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.