Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HERE IS A BETTER VERSION!
- local gui = Instance.new("ScreenGui")
- gui.Name = "SpeedGUI"
- gui.Parent = game.Players.LocalPlayer.PlayerGui
- -- Create a Frame
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 220, 0, 180)
- frame.Position = UDim2.new(0, 10, 0.5, -90) -- Adjusted to center the frame better
- frame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
- frame.BorderSizePixel = 0
- frame.Parent = gui
- -- Create a UICorner to round the edges of the frame
- local frameCorner = Instance.new("UICorner")
- frameCorner.CornerRadius = UDim.new(0, 12)
- frameCorner.Parent = frame
- -- Create a UIStroke for the frame border
- local frameStroke = Instance.new("UIStroke")
- frameStroke.Thickness = 2
- frameStroke.Color = Color3.fromRGB(255, 255, 255)
- frameStroke.Parent = frame
- -- Create a TextLabel above the frame
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(0, 220, 0, 30)
- label.Position = UDim2.new(0, 10, 0.5, -130)
- label.Text = "Enter a speed value"
- label.BackgroundTransparency = 1 -- Make the background transparent
- label.TextColor3 = Color3.fromRGB(255, 255, 255)
- label.BorderSizePixel = 0
- label.Parent = gui
- -- Create a TextBox
- local textBox = Instance.new("TextBox")
- textBox.Size = UDim2.new(0, 180, 0, 40)
- textBox.Position = UDim2.new(0.5, -90, 0.2, 0)
- textBox.Text = "Speed Amount"
- textBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- textBox.TextColor3 = Color3.fromRGB(0, 0, 0)
- textBox.BorderSizePixel = 0
- textBox.Parent = frame
- -- Create a UICorner to round the edges of the textBox
- local textBoxCorner = Instance.new("UICorner")
- textBoxCorner.CornerRadius = UDim.new(0, 8)
- textBoxCorner.Parent = textBox
- -- Create a TextButton
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 120, 0, 40)
- button.Position = UDim2.new(0.5, -60, 0.7, 0)
- button.Text = "Go"
- button.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.BorderSizePixel = 0
- button.Parent = frame
- -- Create a UICorner to round the edges of the button
- local buttonCorner = Instance.new("UICorner")
- buttonCorner.CornerRadius = UDim.new(0, 8)
- buttonCorner.Parent = button
- -- Create TweenService for animations
- local TweenService = game:GetService("TweenService")
- -- Function to animate frame on creation
- local function animateFrameIn()
- frame.Position = UDim2.new(0, 10, 1.5, -90) -- Start position (off-screen)
- label.Position = UDim2.new(0, 10, 1.5, -130) -- Start position (off-screen) for label
- local frameGoal = {}
- frameGoal.Position = UDim2.new(0, 10, 0.5, -90) -- Target position (on-screen)
- local labelGoal = {}
- labelGoal.Position = UDim2.new(0, 10, 0.5, -130) -- Target position (on-screen) for label
- local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local frameTween = TweenService:Create(frame, tweenInfo, frameGoal)
- local labelTween = TweenService:Create(label, tweenInfo, labelGoal)
- frameTween:Play()
- labelTween:Play()
- end
- -- Function to animate button press
- local function animateButtonPress()
- local originalSize = button.Size
- local originalPosition = button.Position
- local goal = {}
- goal.Size = UDim2.new(0, 130, 0, 45)
- goal.Position = UDim2.new(0.5, -65, 0.7, 0)
- local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local tween = TweenService:Create(button, tweenInfo, goal)
- tween.Completed:Connect(function()
- local returnGoal = {}
- returnGoal.Size = originalSize
- returnGoal.Position = originalPosition
- local returnTween = TweenService:Create(button, tweenInfo, returnGoal)
- returnTween:Play()
- end)
- tween:Play()
- end
- -- Function to update walk speed
- local function updateWalkSpeed()
- animateButtonPress()
- local speedValue = tonumber(textBox.Text)
- if speedValue then
- game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = speedValue
- end
- end
- -- Bind the button click event
- button.MouseButton1Click:Connect(updateWalkSpeed)
- -- Animate the frame in
- animateFrameIn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement