Advertisement
Zwiebelle1301706

Asdj9asjd98asjd9

Apr 23rd, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. local function setPlayerSpeed(speed)
  2. local character = game.Players.LocalPlayer.Character
  3. if character then
  4. local humanoid = character:FindFirstChildOfClass("Humanoid")
  5. if humanoid then
  6. humanoid.WalkSpeed = speed
  7. end
  8. end
  9. end
  10.  
  11. -- Create a ScreenGui for the speed input
  12. local screenGui = Instance.new("ScreenGui")
  13. screenGui.Name = "SpeedInputGui"
  14. screenGui.Parent = game.Players.LocalPlayer.PlayerGui
  15.  
  16. -- Create a TextBox for input
  17. local textBox = Instance.new("TextBox")
  18. textBox.Name = "SpeedInput"
  19. textBox.PlaceholderText = "Enter speed..."
  20. textBox.Size = UDim2.new(0, 200, 0, 30)
  21. textBox.Position = UDim2.new(0.5, -100, 0.5, -15)
  22. textBox.AnchorPoint = Vector2.new(0.5, 0.5)
  23. textBox.BackgroundTransparency = 0.5 -- Set background transparency to make it semi-transparent
  24. textBox.BackgroundColor3 = Color3.new(1, 1, 1) -- Set background color to white
  25. textBox.BorderSizePixel = 0 -- Remove border
  26. textBox.TextColor3 = Color3.new(0, 0, 0) -- Set text color to black
  27. textBox.Font = Enum.Font.SourceSans
  28. textBox.TextSize = 14
  29. textBox.Parent = screenGui
  30.  
  31. -- Apply rounded corners to the TextBox
  32. local corner = Instance.new("UICorner")
  33. corner.CornerRadius = UDim.new(0, 5) -- Set corner radius to 5 pixels
  34. corner.Parent = textBox
  35.  
  36. -- Function to handle input changes
  37. textBox.FocusLost:Connect(function(enterPressed)
  38. if enterPressed then
  39. local inputText = textBox.Text
  40. local speed = tonumber(inputText)
  41. if speed then
  42. setPlayerSpeed(speed)
  43. else
  44. textBox.Text = "Invalid input"
  45. wait(2)
  46. textBox.Text = ""
  47. end
  48. end
  49. end)
  50.  
  51. -- Function to toggle GUI visibility
  52. local guiVisible = true
  53. local function toggleGuiVisibility()
  54. guiVisible = not guiVisible
  55. screenGui.Enabled = guiVisible
  56. end
  57.  
  58. -- Toggle GUI visibility when T key is pressed
  59. game:GetService("UserInputService").InputBegan:Connect(function(input)
  60. if input.KeyCode == Enum.KeyCode.T then
  61. toggleGuiVisibility()
  62. end
  63. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement