OpenSource Draggable Gui
Key RequiredUniversal

OpenSource Draggable Gui

Universal ScriptCMDSCMDS 11.8K views 52 executesUpdated Feb 4, 2024
Unrated
00
Lua Script•32 lines (1099 chars)
local UserInputService = game:GetService("UserInputService")
local frame = PutYourFrameNameHere
local dragging
local dragInput
local dragStart
local startPos
local function update(input)
        local delta = input.Position - dragStart
		frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
frame.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = true
			dragStart = input.Position
			startPos = frame.Position
                               input.Changed:Connect(function()
				if input.UserInputState == Enum.UserInputState.End then
					dragging = false
				end
			end)
		end
end)
frame.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)

Features & Information

Draggable gui thingy (made by PawsThePaw)
#Universal#Gui

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts