UnnoobcoolHelper

Touch Football Teleport Football v3

Mar 28th, 2025
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. -- Create the GUI
  2. local ScreenGui = Instance.new("ScreenGui")
  3. local Frame = Instance.new("Frame")
  4. local Button = Instance.new("TextButton")
  5. local TextLabel = Instance.new("TextLabel") -- Create TextLabel
  6.  
  7. -- Properties
  8. ScreenGui.Name = "TeleportBallGui"
  9. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  10.  
  11. Frame.Name = "Frame"
  12. Frame.Parent = ScreenGui
  13. Frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  14. Frame.Position = UDim2.new(0.5, -100, 0.5, -50)
  15. Frame.Size = UDim2.new(0, 200, 0, 100)
  16. Frame.AnchorPoint = Vector2.new(0.5, 0.5)
  17. Frame.Active = true
  18. Frame.Draggable = true
  19.  
  20. Button.Name = "Button"
  21. Button.Parent = Frame
  22. Button.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  23. Button.Position = UDim2.new(0.15, 0, 0.35, 0) -- Positioned below the TextLabel
  24. Button.Size = UDim2.new(0.7, 0, 0.55, 0) -- Adjusted size for better layout
  25. Button.Font = Enum.Font.Cartoon
  26. Button.Text = "Teleport Ball"
  27. Button.TextColor3 = Color3.fromRGB(255, 255, 255)
  28. Button.TextScaled = true
  29.  
  30. -- Create the TextLabel and position it at the top of the Frame
  31. TextLabel.Name = "TextLabel"
  32. TextLabel.Parent = Frame
  33. TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  34. TextLabel.BackgroundTransparency = 1 -- Make the background transparent
  35. TextLabel.Position = UDim2.new(0, 0, 0, 0) -- Positioned at the top of the Frame
  36. TextLabel.Size = UDim2.new(1, 0, 0.3, 0) -- Adjust size to fit at the top
  37. TextLabel.Font = Enum.Font.Cartoon
  38. TextLabel.Text = "Made with hate by Lennox"
  39. TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  40. TextLabel.TextScaled = true
  41.  
  42. -- Script to handle button click
  43. local function onButtonClick()
  44. local player = game.Players.LocalPlayer
  45. local character = player.Character
  46. local field = game.Workspace:FindFirstChild("FootballField")
  47.  
  48. if field then
  49. local ball = field:FindFirstChild("SoccerBall")
  50.  
  51. if character and ball then
  52. local humRootPart = character:FindFirstChild("HumanoidRootPart")
  53.  
  54. if humRootPart then
  55. -- Calculate the new position slightly in front of the player
  56. local direction = humRootPart.CFrame.LookVector
  57. local distance = 3 -- Move the ball 3 units in front of the player
  58. local newPosition = humRootPart.Position + (direction * distance)
  59.  
  60. -- Teleport the ball using CFrame
  61. ball.CFrame = CFrame.new(newPosition)
  62. else
  63. print("HumanoidRootPart not found") -- Output error message for debugging
  64. end
  65. else
  66. print("Character or Ball not found") -- Output error message for debugging
  67. end
  68. else
  69. print("FootballField not found") -- Output error message for debugging
  70. end
  71. end
  72.  
  73. Button.MouseButton1Click:Connect(onButtonClick)
Tags: touch
Add Comment
Please, Sign In to add comment