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

Not A Question A Tutorial On Making Draggable GUI's (For Those Who Don't Know)? [closed]

Asked by 2 years ago
Edited 2 years ago

So First Of Make A ScreenGui....

Done?

Good

Then Insert A Local Script Name It What Ever You Desire

And Paste This Code In It

local Mouse = game.Players.LocalPlayer:GetMouse()
local Off = false
local OnGui = false
while wait() do
    for i,v in pairs(script.Parent:GetChildren()) do
        if v:FindFirstChild("Draggable") then
            v.MouseEnter:Connect(function()
                OnGui = true
            end)    
            v.MouseLeave:Connect(function()
                OnGui = false
            end)
            Mouse.Button1Down:Connect(function()
                if OnGui then
                    Off = true              
                end
            end)
            Mouse.Button1Up:Connect(function()
                Off = false
            end)
            while wait() do
                if Off then
                    v.Position = UDim2.new(0,Mouse.X,0,Mouse.Y)
                end
            end
        end
    end
end

Then Make A Frame And Add A BoolValue In It And Name It "Draggable"

Without Quotation Marks

After That You Should Be Able To Hold Down Your Lest Mouse Button Whilst On The Frame And Move Your Mouse Where Ever You Want

NOTE: THIS DOSENT WORK ON MOBILE (i think)

0
It's kinda a waste of time to write all this code but this module made by Spynaz which you only need to write only 3 lines of code https://devforum.roblox.com/t/simple-module-for-creating-draggable-gui-elements/230678. also if you want to make tutorials do it on the dev forum since this website is to help others with scripting problems MarkedTomato 810 — 2y

Closed as off-topic by greatneil80

This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.

Why was this question closed?