iOSdeveloper

Untitled

Jan 29th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.81 KB | None | 0 0
  1. local player = game:GetService("Players").LocalPlayer
  2. local playerGui = player:WaitForChild("PlayerGui")
  3. local inGameUI = playerGui:WaitForChild("InGameUI")
  4. local abilities = inGameUI.Bottom.Abilities
  5. local ability1 = abilities["2"]
  6.  
  7. local function copyAndChangeAbility()
  8. local copiedAbility = ability2:Clone()
  9. copiedAbility.Timer.Text = "Direct Dribble"
  10. copiedAbility.Parent = abilities
  11. ability2:Destroy()
  12. end
  13.  
  14. copyAndChangeAbility()
  15.  
  16. local function onAbilityClick()
  17. local player = game.Players.LocalPlayer
  18. local character = player.Character or player.CharacterAdded:Wait()
  19. local humanoid = character:WaitForChild("Humanoid")
  20. local animationId = "rbxassetid://76950247429784"
  21. local soundId = "rbxassetid://76709779075029"
  22. local football = workspace:WaitForChild("Football")
  23. local teleportDistance = 26 -- Distance to check if the player is near the football
  24.  
  25. -- Load the animation
  26. local animation = Instance.new("Animation")
  27. animation.AnimationId = animationId
  28. local animationTrack = humanoid:LoadAnimation(animation)
  29.  
  30. -- Function to check distance and teleport
  31. local function checkDistanceAndTeleport()
  32. while true do
  33. wait(1) -- Check every second
  34. local distance = (character.HumanoidRootPart.Position - football.Position).magnitude
  35.  
  36. if distance <= teleportDistance then
  37. -- Teleport the player to the football's position
  38. character:SetPrimaryPartCFrame(football.CFrame)
  39.  
  40. -- Play the animation
  41. animationTrack:Play()
  42.  
  43. -- Play the sound
  44. local sound = Instance.new("Sound")
  45. sound.SoundId = soundId
  46. sound.Parent = character.HumanoidRootPart
  47. sound:Play()
  48.  
  49. -- Optional: Wait for the animation to finish before stopping the sound
  50. animationTrack.Stopped:Wait()
  51. sound:Destroy() -- Clean up the sound after playing
  52. break -- Exit the loop after teleporting
  53. end
  54. end
  55. end
  56.  
  57. -- Start checking distance
  58. checkDistanceAndTeleport()
  59.  
  60. local player = game.Players.LocalPlayer
  61. local character = player.Character or player.CharacterAdded:Wait()
  62. local humanoid = character:WaitForChild("Humanoid")
  63. local animationId = "rbxassetid://99916870664377"
  64. local soundId = "rbxassetid://70582458895457"
  65. local teleportDistance = 20 -- Distance to teleport forward
  66.  
  67. -- Load the animation
  68. local animation = Instance.new("Animation")
  69. animation.AnimationId = animationId
  70. local animationTrack = humanoid:LoadAnimation(animation)
  71.  
  72. -- Function to teleport forward
  73. local function teleportForward()
  74. -- Calculate the new position
  75. local newPosition = character.HumanoidRootPart.Position + (character.HumanoidRootPart.CFrame.LookVector * teleportDistance)
  76.  
  77. -- Teleport the player to the new position
  78. character:SetPrimaryPartCFrame(CFrame.new(newPosition))
  79.  
  80. -- Play the animation
  81. animationTrack:Play()
  82.  
  83. -- Play the sound
  84. local sound = Instance.new("Sound")
  85. sound.SoundId = soundId
  86. sound.Parent = character.HumanoidRootPart
  87. sound:Play()
  88.  
  89. -- Optional: Wait for the animation to finish before stopping the sound
  90. animationTrack.Stopped:Wait()
  91. sound:Destroy() -- Clean up the sound after playing
  92. end
  93.  
  94. -- Call the teleport function
  95. teleportForward()
  96. end
  97.  
  98. ability2.MouseButton1Click:Connect(onAbilityClick)
  99. local player = game:GetService("Players").LocalPlayer
  100. local playerGui = player:WaitForChild("PlayerGui")
  101. local inGameUI = playerGui:WaitForChild("InGameUI")
  102. local abilities = inGameUI.Bottom.Abilities
  103. local ability1 = abilities["2"]
  104.  
  105. -- Change the text of the Timer to "Knuckle shoot"
  106. ability2.Timer.Text = "Knuckle shoot"
  107.  
  108. -- Function to handle the click event
  109. local function onAbilityClick()
  110. local player = game.Players.LocalPlayer
  111. local character = player.Character or player.CharacterAdded:Wait()
  112. local humanoid = character:WaitForChild("Humanoid")
  113. local animationId = "rbxassetid://76950247429784"
  114. local soundId = "rbxassetid://76709779075029"
  115. local football = workspace:WaitForChild("Football")
  116. local teleportDistance = 26 -- Distance to check if the player is near the football
  117.  
  118. -- Load the animation
  119. local animation = Instance.new("Animation")
  120. animation.AnimationId = animationId
  121. local animationTrack = humanoid:LoadAnimation(animation)
  122.  
  123. -- Function to check distance and teleport
  124. local function checkDistanceAndTeleport()
  125. while true do
  126. wait(1) -- Check every second
  127. local distance = (character.HumanoidRootPart.Position - football.Position).magnitude
  128.  
  129. if distance <= teleportDistance then
  130. -- Teleport the player to the football's position
  131. character:SetPrimaryPartCFrame(football.CFrame)
  132.  
  133. -- Play the animation
  134. animationTrack:Play()
  135.  
  136. -- Play the sound
  137. local sound = Instance.new("Sound")
  138. sound.SoundId = soundId
  139. sound.Parent = character.HumanoidRootPart
  140. sound:Play()
  141.  
  142. -- Optional: Wait for the animation to finish before stopping the sound
  143. animationTrack.Stopped:Wait()
  144. sound:Destroy() -- Clean up the sound after playing
  145. break -- Exit the loop after teleporting
  146. end
  147. end
  148. end
  149.  
  150. -- Start checking distance
  151. checkDistanceAndTeleport()
  152.  
  153. local player = game.Players.LocalPlayer
  154. local character = player.Character or player.CharacterAdded:Wait()
  155. local humanoid = character:WaitForChild("Humanoid")
  156. local animationId = "rbxassetid://99916870664377"
  157. local soundId = "rbxassetid://70582458895457"
  158. local teleportDistance = 20 -- Distance to teleport forward
  159.  
  160. -- Load the animation
  161. local animation = Instance.new("Animation")
  162. animation.AnimationId = animationId
  163. local animationTrack = humanoid:LoadAnimation(animation)
  164.  
  165. -- Function to teleport forward
  166. local function teleportForward()
  167. -- Calculate the new position
  168. local newPosition = character.HumanoidRootPart.Position + (character.HumanoidRootPart.CFrame.LookVector * teleportDistance)
  169.  
  170. -- Teleport the player to the new position
  171. character:SetPrimaryPartCFrame(CFrame.new(newPosition))
  172.  
  173. -- Play the animation
  174. animationTrack:Play()
  175.  
  176. -- Play the sound
  177. local sound = Instance.new("Sound")
  178. sound.SoundId = soundId
  179. sound.Parent = character.HumanoidRootPart
  180. sound:Play()
  181.  
  182. -- Optional: Wait for the animation to finish before stopping the sound
  183. animationTrack.Stopped:Wait()
  184. sound:Destroy() -- Clean up the sound after playing
  185. end
  186.  
  187. -- Call the teleport function
  188. teleportForward()
  189. end
  190.  
  191. animationTrack.Stopped:Connect(onAnimationEnded)
  192. end
  193.  
  194. -- Connect the click event to the ability button
  195. ability2.MouseButton1Click:Connect(onAbilityClick)
Advertisement
Add Comment
Please, Sign In to add comment