iOSdeveloper

Untitled

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