Hi, I'm making a GUI right now, but I want it to be dragable, but the current script I have isn't working.
frame = script.Parent.Frame
frame.Draggable = true
-- Draggable Frame
Could you help me?
Hi, I'm making a GUI right now, but I want it to be dragable, but the current script I have isn't working.
frame = script.Parent.Frame
frame.Draggable = true
-- Draggable Frame
Could you help me?
Draggable has sadly Removed. but you can use this:
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)
you should add this script in specific object. (from https://devforum.roblox.com/t/draggable-property-is-hidden-on-gui-objects/107689/4)
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
If that doesn't work try moving the frame when the mouse moves via UserInputService.InputBegan
What does that mean? I just a learner scripter xD
Ok, I fixed it.
If so edit your title so it contains [SOLVED] so people know it has been solved.