Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local buttonActivated = false
- local gui = nil
- -- Function to activate the script
- local function activateScript()
- -- Create a ScreenGui to hold the GUI elements
- local gui = Instance.new("ScreenGui")
- gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- -- Create a Frame to hold the GUI elements
- local frame = Instance.new("Frame")
- frame.Parent = gui
- frame.Size = UDim2.new(0.6, 0, 0.6, 0)
- frame.Position = UDim2.new(0.2, 0, 0.2, 0)
- frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Black background
- -- Mouse input events
- local dragStart
- local dragging
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- end
- end)
- frame.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(0, frame.Position.X.Offset + delta.X, 0, frame.Position.Y.Offset + delta.Y)
- dragStart = input.Position
- end
- end)
- frame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- -- Touch input events
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- end
- end)
- frame.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.Touch then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(0, frame.Position.X.Offset + delta.X, 0, frame.Position.Y.Offset + delta.Y)
- dragStart = input.Position
- end
- end)
- frame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch then
- dragging = false
- end
- end)
- -- Create a Title for the GUI
- local title = Instance.new("TextLabel")
- title.Parent = frame
- title.Size = UDim2.new(1, 0, 0.1, 0)
- title.Position = UDim2.new(0, 0, 0, 0)
- title.BackgroundTransparency = 1
- title.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
- title.TextScaled = true
- title.Font = Enum.Font.SourceSansBold
- title.Text = "ScriptMaster v2"
- -- Create an X button to close the GUI
- local xButton = Instance.new("TextButton")
- xButton.Parent = frame
- xButton.Size = UDim2.new(0.1, 0, 0.1, 0)
- xButton.Position = UDim2.new(0.9, 0, 0, 0)
- xButton.Text = "X"
- xButton.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red text
- xButton.BackgroundTransparency = 1
- xButton.MouseButton1Click:Connect(function()
- gui:Destroy()
- end)
- -- Create a TextBox for entering Lua code
- local textBox = Instance.new("TextBox")
- textBox.Parent = frame
- textBox.Size = UDim2.new(0.8, 0, 0.6, 0)
- textBox.Position = UDim2.new(0.1, 0, 0.1, 0)
- textBox.MultiLine = true
- textBox.TextWrapped = true
- textBox.ClearTextOnFocus = false
- textBox.Text = "Enter Lua code here"
- textBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- White background
- textBox.TextColor3 = Color3.fromRGB(0, 0, 0) -- Black text
- textBox.BorderSizePixel = 2
- -- Create a Button to execute the Lua code
- local executeButton = Instance.new("TextButton")
- executeButton.Parent = frame
- executeButton.Size = UDim2.new(0.2, 0, 0.1, 0)
- executeButton.Position = UDim2.new(0.4, 0, 0.8, 0)
- executeButton.Text = "Execute"
- executeButton.MouseButton1Click:Connect(function()
- local luaCode = textBox.Text
- local success, errorMessage = pcall(loadstring(luaCode))
- if not success then
- print("Error executing Lua code:", errorMessage)
- end
- end)
- -- Create a Notes button
- local notesButton = Instance.new("TextButton")
- notesButton.Parent = frame
- notesButton.Size = UDim2.new(0.1, 0, 0.1, 0)
- notesButton.Position = UDim2.new(0, 0, 0, 0)
- notesButton.Text = "Notes"
- notesButton.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
- notesButton.BackgroundTransparency = 1
- notesButton.MouseButton1Click:Connect(function()
- -- Create a ScreenGui to hold the GUI elements
- local gui = Instance.new("ScreenGui")
- gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- -- Create a Frame to hold the GUI elements
- local frame = Instance.new("Frame")
- frame.Parent = gui
- frame.Size = UDim2.new(0.6, 0, 0.6, 0)
- frame.Position = UDim2.new(0.2, 0, 0.2, 0)
- frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Black background
- -- Mouse input events
- local dragStart
- local dragging
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- end
- end)
- frame.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(0, frame.Position.X.Offset + delta.X, 0, frame.Position.Y.Offset + delta.Y)
- dragStart = input.Position
- end
- end)
- frame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- -- Touch input events
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- end
- end)
- frame.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.Touch then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(0, frame.Position.X.Offset + delta.X, 0, frame.Position.Y.Offset + delta.Y)
- dragStart = input.Position
- end
- end)
- frame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch then
- dragging = false
- end
- end)
- -- Create a Title for the GUI
- local title = Instance.new("TextLabel")
- title.Parent = frame
- title.Size = UDim2.new(1, 0, 0.1, 0)
- title.Position = UDim2.new(0, 0, 0, 0)
- title.BackgroundTransparency = 1
- title.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
- title.TextScaled = true
- title.Font = Enum.Font.SourceSansBold
- title.Text = "ScriptNote v1"
- -- Create an X button to close the GUI
- local xButton = Instance.new("TextButton")
- xButton.Parent = frame
- xButton.Size = UDim2.new(0.1, 0, 0.1, 0)
- xButton.Position = UDim2.new(0.9, 0, 0, 0)
- xButton.Text = "X"
- xButton.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red text
- xButton.BackgroundTransparency = 1
- xButton.MouseButton1Click:Connect(function()
- gui:Destroy()
- end)
- -- Create a TextBox for entering Lua code
- local textBox = Instance.new("TextBox")
- textBox.Parent = frame
- textBox.Size = UDim2.new(0.8, 0, 0.6, 0)
- textBox.Position = UDim2.new(0.1, 0, 0.1, 0)
- textBox.MultiLine = true
- textBox.TextWrapped = true
- textBox.ClearTextOnFocus = false
- textBox.Text = "Enter text here"
- textBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- White background
- textBox.TextColor3 = Color3.fromRGB(0, 0, 0) -- Black text
- textBox.BorderSizePixel = 2
- -- Rainbow effect for the outline color of the TextBox
- local rainbowColors = {
- Color3.fromRGB(255, 0, 0), -- Red
- Color3.fromRGB(255, 127, 0), -- Orange
- Color3.fromRGB(255, 255, 0), -- Yellow
- Color3.fromRGB(0, 255, 0), -- Green
- Color3.fromRGB(0, 0, 255), -- Blue
- Color3.fromRGB(75, 0, 130) -- Indigo
- }
- local currentColorIndex = 1
- while true do
- textBox.BorderColor3 = rainbowColors[currentColorIndex]
- wait(0.1)
- currentColorIndex = currentColorIndex % #rainbowColors + 1
- end
- print("Notes button clicked")
- end)
- -- Rainbow effect for the outline color of the TextBox
- local rainbowColors = {
- Color3.fromRGB(255, 0, 0), -- Red
- Color3.fromRGB(255, 127, 0), -- Orange
- Color3.fromRGB(255, 255, 0), -- Yellow
- Color3.fromRGB(0, 255, 0), -- Green
- Color3.fromRGB(0, 0, 255), -- Blue
- Color3.fromRGB(75, 0, 130) -- Indigo
- }
- local currentColorIndex = 1
- while true do
- textBox.BorderColor3 = rainbowColors[currentColorIndex]
- wait(0.1)
- currentColorIndex = currentColorIndex % #rainbowColors + 1
- end
- print("Script activated!")
- end
- -- Function to delete the script
- local function deleteScript()
- script:Destroy()
- end
- -- Function to toggle the button state
- local function toggleButton()
- if not buttonActivated then
- activateScript()
- buttonActivated = true
- else
- deleteScript()
- buttonActivated = false
- end
- end
- -- Make the button draggable
- local function enableDragging(frame)
- 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)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- end
- -- Create a ScreenGui and TextButton for the button
- gui = Instance.new("ScreenGui")
- gui.Parent = player.PlayerGui
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 100, 0, 50)
- button.Position = UDim2.new(0.5, -50, 0.5, -25)
- button.Text = "Activate gui"
- button.Parent = gui
- -- Enable dragging for the button
- enableDragging(button)
- -- Connect the toggleButton function to the button's Click event
- button.MouseButton1Click:Connect(function()
- button.Visible = false
- toggleButton()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement