iOSdeveloper

Untitled

Apr 25th, 2025
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local LocalPlayer = Players.LocalPlayer
  3. local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
  4. local UIS = game:GetService("UserInputService")
  5.  
  6. local function waitForCharacter()
  7. while not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Humanoid") do
  8. wait()
  9. end
  10. return LocalPlayer.Character.Humanoid
  11. end
  12.  
  13. local Humanoid = waitForCharacter()
  14.  
  15. local screenGui = Instance.new("ScreenGui")
  16. screenGui.Parent = PlayerGui
  17. screenGui.Name = "WalkSpeedUI"
  18.  
  19. local frame = Instance.new("Frame")
  20. frame.Size = UDim2.new(0, 400, 0, 100)
  21. frame.Position = UDim2.new(0.5, -200, 0.5, -50)
  22. frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  23. frame.BackgroundTransparency = 0.5
  24. frame.Parent = screenGui
  25.  
  26. local walkSpeedLabel = Instance.new("TextLabel")
  27. walkSpeedLabel.Size = UDim2.new(0, 400, 0, 50)
  28. walkSpeedLabel.Position = UDim2.new(0, 0, 0, 0)
  29. walkSpeedLabel.Text = "Walk Speed: 16"
  30. walkSpeedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  31. walkSpeedLabel.TextSize = 24
  32. walkSpeedLabel.BackgroundTransparency = 1
  33. walkSpeedLabel.Parent = frame
  34.  
  35. local slider = Instance.new("Frame")
  36. slider.Size = UDim2.new(0, 300, 0, 10)
  37. slider.Position = UDim2.new(0.5, -150, 0, 50)
  38. slider.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  39. slider.Parent = frame
  40.  
  41. local sliderButton = Instance.new("Frame")
  42. sliderButton.Size = UDim2.new(0, 20, 0, 20)
  43. sliderButton.Position = UDim2.new(0, 0, 0, -5)
  44. sliderButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  45. sliderButton.Parent = slider
  46.  
  47. local function updateWalkSpeed(newSpeed)
  48. walkSpeedLabel.Text = "Walk Speed: " .. newSpeed
  49. Humanoid.WalkSpeed = newSpeed
  50. end
  51.  
  52. local draggingSlider = false
  53. local startPosSlider = Vector2.new(0, 0)
  54.  
  55. sliderButton.InputBegan:Connect(function(input)
  56. if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
  57. draggingSlider = true
  58. startPosSlider = input.Position
  59. UIS.TouchEnabled = false
  60. end
  61. end)
  62.  
  63. sliderButton.InputChanged:Connect(function(input)
  64. if draggingSlider and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseMovement) then
  65. local delta = input.Position.X - startPosSlider.X
  66. local newX = math.clamp(sliderButton.Position.X.Offset + delta, 0, slider.Size.X.Offset - sliderButton.Size.X.Offset)
  67. sliderButton.Position = UDim2.new(0, newX, 0, -5)
  68.  
  69. local walkSpeed = math.floor((newX / (slider.Size.X.Offset - sliderButton.Size.X.Offset)) * 100)
  70. updateWalkSpeed(walkSpeed)
  71. startPosSlider = input.Position
  72. end
  73. end)
  74.  
  75. sliderButton.InputEnded:Connect(function(input)
  76. if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
  77. draggingSlider = false
  78. UIS.TouchEnabled = true
  79. end
  80. end)
  81.  
  82. local frameDragging = false
  83. local startPosFrame = Vector2.new(0, 0)
  84.  
  85. local dragCorner = Instance.new("Frame")
  86. dragCorner.Size = UDim2.new(0, 20, 0, 20)
  87. dragCorner.Position = UDim2.new(1, -20, 1, -20)
  88. dragCorner.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  89. dragCorner.Parent = frame
  90.  
  91. dragCorner.InputBegan:Connect(function(input)
  92. if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
  93. frameDragging = true
  94. startPosFrame = input.Position
  95. UIS.TouchEnabled = false
  96. end
  97. end)
  98.  
  99. dragCorner.InputChanged:Connect(function(input)
  100. if frameDragging and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseMovement) then
  101. local delta = input.Position - startPosFrame
  102. frame.Position = frame.Position + UDim2.new(0, delta.X, 0, delta.Y)
  103. startPosFrame = input.Position
  104. end
  105. end)
  106.  
  107. dragCorner.InputEnded:Connect(function(input)
  108. if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
  109. frameDragging = false
  110. UIS.TouchEnabled = true
  111. end
  112. end)
  113.  
Advertisement
Add Comment
Please, Sign In to add comment