So I was wondering, is there anyway to create a draggable GUI? Should I just look for a script on the toolbox or get professional help from here? So I chose the DevForum.
So, does anyone know how to do this?
So I was wondering, is there anyway to create a draggable GUI? Should I just look for a script on the toolbox or get professional help from here? So I chose the DevForum.
So, does anyone know how to do this?
You can use, Mouse Enter function for the frame, and mouse leave, so if it enters, youcan set a variable to ‘true’
And maybe using Mouse.Button1Down or UserinputService, with a loop, while the variable is true, move the Frame position according to mouse.Y and mouse.X
There’s an open sourced module just for this
-- >> Rename frame to the frame you want to be draggable
frame = script.Parent.Frame
frame.Draggable = true
frame.Active = true
frame.Selectable = true
I think Draggable is deprecated( correct me if I’m wrong)
Indeed. Draggable is no longer here. It was removed.
RIP Draggable Property - The Most Valuable Property
The draggable property has been deprecated as we can see. Use this snippet from Tiffblocks instead (i couldnt find the original forum) and also if you dont wanna use module this is a solution:
local UserInputService = game:GetService("UserInputService")
local gui = script.Parent
local dragging
local dragInput
local dragStart
local startPos
local function update(input)
local delta = input.Position - dragStart
gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
gui.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = gui.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
gui.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
update(input)
end
end)
for me, the draggable property on frames still works. u just need to change the .Active property to true
Try not to use deprecated features.
why? i use draggable sometimes. Nothing bad happened.
You can use it, it’s just deprecated so it could suddenly cause disruptions in the experience.
oh okay then. thank you for letting me know.
Deprecated code can lead to problems and make the program or task not work. Using better functions and proper services improves preformance even if it’s more lines of code.
Roblox’s draggable feature is not good. If you drag too fast it will not register because your mouse slid off it. I use draggify because I love the smooth draggability.