0% found this document useful (0 votes)
101 views3 pages

Roblox GUI Toggle Script

Uploaded by

khuonglamtan199
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views3 pages

Roblox GUI Toggle Script

Uploaded by

khuonglamtan199
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

local ScreenGui = Instance.

new("ScreenGui")
local TextButton = [Link]("TextButton")
local UICorner = [Link]("UICorner")

[Link] = [Link]:WaitForChild("PlayerGui")
[Link] = "ScreenGui"
[Link] = [Link]

[Link] = "TextButton"
[Link] = ScreenGui
TextButton.BackgroundColor3 = [Link](0, 0, 0)
[Link] = [Link](0.159199998, 0, 0.25920248, 0)
[Link] = [Link](0, 70, 0, 70)
[Link] = [Link]
[Link] = "open"
TextButton.TextColor3 = [Link](255, 255, 255)
[Link] = 41.000
[Link] = true
[Link] = true

[Link] = TextButton

local toggleState = true

TextButton.MouseButton1Click:Connect(function()

toggleState = not toggleState -- Toggling the state


if toggleState then
[Link] = "close"

game:GetService("VirtualInputManager"):SendKeyEvent(true,[Link],f
alse,game)
else
[Link] = "open"

game:GetService("VirtualInputManager"):SendKeyEvent(true,[Link],f
alse,game)
end
end)

local function drag()


local script = [Link]('LocalScript', TextButton)
local UIS = game:GetService('UserInputService')
local frame = [Link]
local dragToggle = nil
local dragSpeed = 0.25
local dragStart = nil
local startPos = nil

local function updateInput(input)


local delta = [Link] - dragStart
local position = [Link]([Link], [Link] +
delta.X,
[Link], [Link] + delta.Y)
game:GetService('TweenService'):Create(frame, [Link](dragSpeed),
{Position = position}):Play()
end

[Link]:Connect(function(input)
if ([Link] == [Link].MouseButton1 or
[Link] == [Link]) then
dragToggle = true
dragStart = [Link]
startPos = [Link]
[Link]:Connect(function()
if [Link] == [Link] then
dragToggle = false
end
end)
end
end)

[Link]:Connect(function(input)
if [Link] == [Link] or
[Link] == [Link] then
if dragToggle then
updateInput(input)
end
end
end)

end
[Link](drag)()

local function drag2()


local script = [Link]('LocalScript', Frame)
local UIS = game:GetService('UserInputService')
local frame = [Link]
local dragToggle = nil
local dragSpeed = 0.25
local dragStart = nil
local startPos = nil

local function updateInput(input)


local delta = [Link] - dragStart
local position = [Link]([Link], [Link] +
delta.X,
[Link], [Link] + delta.Y)
game:GetService('TweenService'):Create(frame, [Link](dragSpeed),
{Position = position}):Play()
end

[Link]:Connect(function(input)
if ([Link] == [Link].MouseButton1 or
[Link] == [Link]) then
dragToggle = true
dragStart = [Link]
startPos = [Link]
[Link]:Connect(function()
if [Link] == [Link] then
dragToggle = false
end
end)
end
end)

[Link]:Connect(function(input)
if [Link] == [Link] or
[Link] == [Link] then
if dragToggle then
updateInput(input)
end
end
end)

end
[Link](drag2)()

You might also like