Advertisement
PeperVr

Untitled

Jun 23rd, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. HERE IS A BETTER VERSION!
  2.  
  3. local gui = Instance.new("ScreenGui")
  4. gui.Name = "SpeedGUI"
  5. gui.Parent = game.Players.LocalPlayer.PlayerGui
  6.  
  7. -- Create a Frame
  8. local frame = Instance.new("Frame")
  9. frame.Size = UDim2.new(0, 220, 0, 180)
  10. frame.Position = UDim2.new(0, 10, 0.5, -90) -- Adjusted to center the frame better
  11. frame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  12. frame.BorderSizePixel = 0
  13. frame.Parent = gui
  14.  
  15. -- Create a UICorner to round the edges of the frame
  16. local frameCorner = Instance.new("UICorner")
  17. frameCorner.CornerRadius = UDim.new(0, 12)
  18. frameCorner.Parent = frame
  19.  
  20. -- Create a UIStroke for the frame border
  21. local frameStroke = Instance.new("UIStroke")
  22. frameStroke.Thickness = 2
  23. frameStroke.Color = Color3.fromRGB(255, 255, 255)
  24. frameStroke.Parent = frame
  25.  
  26. -- Create a TextLabel above the frame
  27. local label = Instance.new("TextLabel")
  28. label.Size = UDim2.new(0, 220, 0, 30)
  29. label.Position = UDim2.new(0, 10, 0.5, -130)
  30. label.Text = "Enter a speed value"
  31. label.BackgroundTransparency = 1 -- Make the background transparent
  32. label.TextColor3 = Color3.fromRGB(255, 255, 255)
  33. label.BorderSizePixel = 0
  34. label.Parent = gui
  35.  
  36. -- Create a TextBox
  37. local textBox = Instance.new("TextBox")
  38. textBox.Size = UDim2.new(0, 180, 0, 40)
  39. textBox.Position = UDim2.new(0.5, -90, 0.2, 0)
  40. textBox.Text = "Speed Amount"
  41. textBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  42. textBox.TextColor3 = Color3.fromRGB(0, 0, 0)
  43. textBox.BorderSizePixel = 0
  44. textBox.Parent = frame
  45.  
  46. -- Create a UICorner to round the edges of the textBox
  47. local textBoxCorner = Instance.new("UICorner")
  48. textBoxCorner.CornerRadius = UDim.new(0, 8)
  49. textBoxCorner.Parent = textBox
  50.  
  51. -- Create a TextButton
  52. local button = Instance.new("TextButton")
  53. button.Size = UDim2.new(0, 120, 0, 40)
  54. button.Position = UDim2.new(0.5, -60, 0.7, 0)
  55. button.Text = "Go"
  56. button.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  57. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  58. button.BorderSizePixel = 0
  59. button.Parent = frame
  60.  
  61. -- Create a UICorner to round the edges of the button
  62. local buttonCorner = Instance.new("UICorner")
  63. buttonCorner.CornerRadius = UDim.new(0, 8)
  64. buttonCorner.Parent = button
  65.  
  66. -- Create TweenService for animations
  67. local TweenService = game:GetService("TweenService")
  68.  
  69. -- Function to animate frame on creation
  70. local function animateFrameIn()
  71. frame.Position = UDim2.new(0, 10, 1.5, -90) -- Start position (off-screen)
  72. label.Position = UDim2.new(0, 10, 1.5, -130) -- Start position (off-screen) for label
  73. local frameGoal = {}
  74. frameGoal.Position = UDim2.new(0, 10, 0.5, -90) -- Target position (on-screen)
  75. local labelGoal = {}
  76. labelGoal.Position = UDim2.new(0, 10, 0.5, -130) -- Target position (on-screen) for label
  77. local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  78. local frameTween = TweenService:Create(frame, tweenInfo, frameGoal)
  79. local labelTween = TweenService:Create(label, tweenInfo, labelGoal)
  80. frameTween:Play()
  81. labelTween:Play()
  82. end
  83.  
  84. -- Function to animate button press
  85. local function animateButtonPress()
  86. local originalSize = button.Size
  87. local originalPosition = button.Position
  88.  
  89. local goal = {}
  90. goal.Size = UDim2.new(0, 130, 0, 45)
  91. goal.Position = UDim2.new(0.5, -65, 0.7, 0)
  92.  
  93. local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  94. local tween = TweenService:Create(button, tweenInfo, goal)
  95.  
  96. tween.Completed:Connect(function()
  97. local returnGoal = {}
  98. returnGoal.Size = originalSize
  99. returnGoal.Position = originalPosition
  100.  
  101. local returnTween = TweenService:Create(button, tweenInfo, returnGoal)
  102. returnTween:Play()
  103. end)
  104.  
  105. tween:Play()
  106. end
  107.  
  108. -- Function to update walk speed
  109. local function updateWalkSpeed()
  110. animateButtonPress()
  111. local speedValue = tonumber(textBox.Text)
  112. if speedValue then
  113. game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = speedValue
  114. end
  115. end
  116.  
  117. -- Bind the button click event
  118. button.MouseButton1Click:Connect(updateWalkSpeed)
  119.  
  120. -- Animate the frame in
  121. animateFrameIn()
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement