Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
- local UIS = game:GetService("UserInputService")
- local function waitForCharacter()
- while not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Humanoid") do
- wait()
- end
- return LocalPlayer.Character.Humanoid
- end
- local Humanoid = waitForCharacter()
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = PlayerGui
- screenGui.Name = "WalkSpeedUI"
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 400, 0, 100)
- frame.Position = UDim2.new(0.5, -200, 0.5, -50)
- frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- frame.BackgroundTransparency = 0.5
- frame.Parent = screenGui
- local walkSpeedLabel = Instance.new("TextLabel")
- walkSpeedLabel.Size = UDim2.new(0, 400, 0, 50)
- walkSpeedLabel.Position = UDim2.new(0, 0, 0, 0)
- walkSpeedLabel.Text = "Walk Speed: 16"
- walkSpeedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- walkSpeedLabel.TextSize = 24
- walkSpeedLabel.BackgroundTransparency = 1
- walkSpeedLabel.Parent = frame
- local slider = Instance.new("Frame")
- slider.Size = UDim2.new(0, 300, 0, 10)
- slider.Position = UDim2.new(0.5, -150, 0, 50)
- slider.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- slider.Parent = frame
- local sliderButton = Instance.new("Frame")
- sliderButton.Size = UDim2.new(0, 20, 0, 20)
- sliderButton.Position = UDim2.new(0, 0, 0, -5)
- sliderButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- sliderButton.Parent = slider
- local function updateWalkSpeed(newSpeed)
- walkSpeedLabel.Text = "Walk Speed: " .. newSpeed
- Humanoid.WalkSpeed = newSpeed
- end
- local draggingSlider = false
- local startPosSlider = Vector2.new(0, 0)
- sliderButton.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
- draggingSlider = true
- startPosSlider = input.Position
- UIS.TouchEnabled = false
- end
- end)
- sliderButton.InputChanged:Connect(function(input)
- if draggingSlider and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseMovement) then
- local delta = input.Position.X - startPosSlider.X
- local newX = math.clamp(sliderButton.Position.X.Offset + delta, 0, slider.Size.X.Offset - sliderButton.Size.X.Offset)
- sliderButton.Position = UDim2.new(0, newX, 0, -5)
- local walkSpeed = math.floor((newX / (slider.Size.X.Offset - sliderButton.Size.X.Offset)) * 100)
- updateWalkSpeed(walkSpeed)
- startPosSlider = input.Position
- end
- end)
- sliderButton.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
- draggingSlider = false
- UIS.TouchEnabled = true
- end
- end)
- local frameDragging = false
- local startPosFrame = Vector2.new(0, 0)
- local dragCorner = Instance.new("Frame")
- dragCorner.Size = UDim2.new(0, 20, 0, 20)
- dragCorner.Position = UDim2.new(1, -20, 1, -20)
- dragCorner.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- dragCorner.Parent = frame
- dragCorner.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
- frameDragging = true
- startPosFrame = input.Position
- UIS.TouchEnabled = false
- end
- end)
- dragCorner.InputChanged:Connect(function(input)
- if frameDragging and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseMovement) then
- local delta = input.Position - startPosFrame
- frame.Position = frame.Position + UDim2.new(0, delta.X, 0, delta.Y)
- startPosFrame = input.Position
- end
- end)
- dragCorner.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
- frameDragging = false
- UIS.TouchEnabled = true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment