Advertisement
KenshiOfficial

Untitled

Dec 16th, 2024
3,530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. -- Create the GUI
  2. local ScreenGui = Instance.new("ScreenGui")
  3. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  4.  
  5. -- Create a frame to hold the draggable UI elements
  6. local DraggableFrame = Instance.new("Frame")
  7. DraggableFrame.Parent = ScreenGui
  8. DraggableFrame.Size = UDim2.new(0, 300, 0, 200)
  9. DraggableFrame.Position = UDim2.new(0.5, -150, 0.5, -100) -- Centered
  10. DraggableFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  11. DraggableFrame.BorderSizePixel = 0
  12. DraggableFrame.Draggable = true
  13. DraggableFrame.Active = true
  14.  
  15. -- Create the Shoot button
  16. local ShootButton = Instance.new("TextButton")
  17. ShootButton.Parent = DraggableFrame
  18. ShootButton.Text = "Shoot Down Fast"
  19. ShootButton.Size = UDim2.new(0, 150, 0, 50)
  20. ShootButton.Position = UDim2.new(0.5, -75, 0, 10) -- Positioned inside DraggableFrame
  21. ShootButton.BackgroundColor3 = Color3.fromRGB(0, 128, 255)
  22. ShootButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  23. ShootButton.Font = Enum.Font.SourceSansBold
  24. ShootButton.TextSize = 20
  25.  
  26. -- Create a TextBox for custom shot speed input
  27. local SpeedTextBox = Instance.new("TextBox")
  28. SpeedTextBox.Parent = DraggableFrame
  29. SpeedTextBox.Size = UDim2.new(0, 200, 0, 40)
  30. SpeedTextBox.Position = UDim2.new(0.5, -100, 0.6, 0) -- Below the button
  31. SpeedTextBox.Text = "300" -- Default value
  32. SpeedTextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  33. SpeedTextBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  34. SpeedTextBox.BorderSizePixel = 0
  35. SpeedTextBox.Font = Enum.Font.SourceSans
  36. SpeedTextBox.PlaceholderText = "Enter Speed (e.g., 300)"
  37. SpeedTextBox.TextSize = 20
  38.  
  39. -- Create a label for showing the shot speed
  40. local SpeedLabel = Instance.new("TextLabel")
  41. SpeedLabel.Parent = DraggableFrame
  42. SpeedLabel.Size = UDim2.new(0, 200, 0, 50)
  43. SpeedLabel.Position = UDim2.new(0.5, -100, 0.7, 0) -- Below the textbox
  44. SpeedLabel.Text = "Shot Speed: " .. SpeedTextBox.Text
  45. SpeedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  46. SpeedLabel.BackgroundTransparency = 1
  47. SpeedLabel.TextSize = 20
  48.  
  49. -- Update the shot speed label whenever the text changes
  50. SpeedTextBox.FocusLost:Connect(function()
  51. local inputValue = tonumber(SpeedTextBox.Text)
  52. if inputValue then
  53. SpeedLabel.Text = "Shot Speed: " .. inputValue
  54. else
  55. SpeedLabel.Text = "Invalid Speed"
  56. end
  57. end)
  58.  
  59. -- Define the shooting functionality
  60. local function shootFastDown()
  61. -- Define the target direction for shooting downwards like a goal
  62. local downwardDirection = Vector3.new(0, -50, -100) -- Aim downward and forward
  63.  
  64. -- Get the shot speed from the text box (converted to a number)
  65. local shotPower = tonumber(SpeedTextBox.Text) or 300 -- Default to 300 if input is invalid
  66.  
  67. -- Fire the server to shoot the ball downward and forward
  68. local args = {
  69. [1] = shotPower, -- Shot power
  70. [4] = downwardDirection -- Target direction (downward)
  71. }
  72.  
  73. game:GetService("ReplicatedStorage"):WaitForChild("Packages"):WaitForChild("Knit"):WaitForChild("Services"):WaitForChild("BallService"):WaitForChild("RE"):WaitForChild("Shoot"):FireServer(unpack(args))
  74.  
  75. print("Ball shot downward with speed: " .. shotPower)
  76. end
  77.  
  78. -- Connect the button to the function
  79. ShootButton.MouseButton1Click:Connect(shootFastDown)
  80.  
  81. -- Add drag functionality for mobile/PC
  82. local dragging, dragInput, dragStart, startPos
  83.  
  84. -- Function to start dragging
  85. DraggableFrame.InputBegan:Connect(function(input)
  86. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  87. dragging = true
  88. dragStart = input.Position
  89. startPos = DraggableFrame.Position
  90. end
  91. end)
  92.  
  93. -- Function to drag the frame
  94. DraggableFrame.InputChanged:Connect(function(input)
  95. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  96. local delta = input.Position - dragStart
  97. DraggableFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  98. end
  99. end)
  100.  
  101. -- Function to stop dragging
  102. DraggableFrame.InputEnded:Connect(function(input)
  103. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  104. dragging = false
  105. end
  106. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement