Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function setPlayerSpeed(speed)
- local character = game.Players.LocalPlayer.Character
- if character then
- local humanoid = character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- humanoid.WalkSpeed = speed
- end
- end
- end
- -- Create a ScreenGui for the speed input
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "SpeedInputGui"
- screenGui.Parent = game.Players.LocalPlayer.PlayerGui
- -- Create a TextBox for input
- local textBox = Instance.new("TextBox")
- textBox.Name = "SpeedInput"
- textBox.PlaceholderText = "Enter speed..."
- textBox.Size = UDim2.new(0, 200, 0, 30)
- textBox.Position = UDim2.new(0.5, -100, 0.5, -15)
- textBox.AnchorPoint = Vector2.new(0.5, 0.5)
- textBox.BackgroundTransparency = 0.5 -- Set background transparency to make it semi-transparent
- textBox.BackgroundColor3 = Color3.new(1, 1, 1) -- Set background color to white
- textBox.BorderSizePixel = 0 -- Remove border
- textBox.TextColor3 = Color3.new(0, 0, 0) -- Set text color to black
- textBox.Font = Enum.Font.SourceSans
- textBox.TextSize = 14
- textBox.Parent = screenGui
- -- Apply rounded corners to the TextBox
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 5) -- Set corner radius to 5 pixels
- corner.Parent = textBox
- -- Function to handle input changes
- textBox.FocusLost:Connect(function(enterPressed)
- if enterPressed then
- local inputText = textBox.Text
- local speed = tonumber(inputText)
- if speed then
- setPlayerSpeed(speed)
- else
- textBox.Text = "Invalid input"
- wait(2)
- textBox.Text = ""
- end
- end
- end)
- -- Function to toggle GUI visibility
- local guiVisible = true
- local function toggleGuiVisibility()
- guiVisible = not guiVisible
- screenGui.Enabled = guiVisible
- end
- -- Toggle GUI visibility when T key is pressed
- game:GetService("UserInputService").InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.T then
- toggleGuiVisibility()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement