iOSdeveloper

Untitled

Jan 29th, 2025 (edited)
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.93 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["1"]
  6.  
  7. local function copyAndChangeAbility()
  8. local copiedAbility = ability1:Clone()
  9. copiedAbility.Timer.Text = "Knuckle shoot"
  10. copiedAbility.Parent = abilities
  11. ability1:Destroy()
  12. end
  13.  
  14. copyAndChangeAbility()
  15.  
  16. local function onAbilityClick()
  17. local character = player.Character or player.CharacterAdded:Wait()
  18. local humanoid = character:WaitForChild("Humanoid")
  19. local animationId = "rbxassetid://122513708013347"
  20. local soundId = "rbxassetid://87838758006658"
  21.  
  22. local animation = Instance.new("Animation")
  23. animation.AnimationId = animationId
  24. local animationTrack = humanoid:LoadAnimation(animation)
  25.  
  26. animationTrack:Play()
  27.  
  28. local function fireRemoteAndPlaySoundHalfway()
  29. local animationLength = animationTrack.Length
  30. wait(animationLength / 2)
  31.  
  32. local sound = Instance.new("Sound")
  33. sound.SoundId = soundId
  34. sound.Parent = character
  35. sound:Play()
  36.  
  37. local args = {
  38. [1] = 200,
  39. }
  40. game:GetService("ReplicatedStorage").Packages.Knit.Services.BallService.RE.Shoot:FireServer(unpack(args))
  41. end
  42.  
  43. fireRemoteAndPlaySoundHalfway()
  44.  
  45. local function onAnimationEnded()
  46. animationTrack:Stop()
  47. end
  48.  
  49. animationTrack.Stopped:Connect(onAnimationEnded)
  50. end
  51.  
  52. ability1.MouseButton1Click:Connect(onAbilityClick)
  53.  
  54. local player = game:GetService("Players").LocalPlayer
  55. local playerGui = player:WaitForChild("PlayerGui")
  56. local inGameUI = playerGui:WaitForChild("InGameUI")
  57. local abilities = inGameUI.Bottom.Abilities
  58. local ability1 = abilities["1"]
  59.  
  60. ability1.Timer.Text = "Knuckle shoot"
  61.  
  62. local function onAbilityClick()
  63. local character = player.Character or player.CharacterAdded:Wait()
  64. local hasBallValue = character:FindFirstChild("Values") and character.Values:FindFirstChild("HasBall")
  65.  
  66. if hasBallValue and hasBallValue.Value then
  67. local humanoid = character:WaitForChild("Humanoid")
  68. local animationId = "rbxassetid://122513708013347"
  69. local soundId = "rbxassetid://87838758006658"
  70.  
  71. local animation = Instance.new("Animation")
  72. animation.AnimationId = animationId
  73. local animationTrack = humanoid:LoadAnimation(animation)
  74.  
  75. animationTrack:Play()
  76.  
  77. local function fireRemoteAndPlaySoundHalfway()
  78. local animationLength = animationTrack.Length
  79. wait(animationLength / 2)
  80.  
  81. local sound = Instance.new("Sound")
  82. sound.SoundId = soundId
  83. sound.Parent = character
  84. sound:Play()
  85. sound.Ended:Connect(function() sound:Destroy() end) -- Clean up sound after it finishes
  86.  
  87. local args = {
  88. [1] = 200,
  89. }
  90. game:GetService("ReplicatedStorage").Packages.Knit.Services.BallService.RE.Shoot:FireServer(unpack(args))
  91. end
  92.  
  93. fireRemoteAndPlaySoundHalfway()
  94.  
  95. local function onAnimationEnded()
  96. -- You can add any logic here if needed when the animation ends
  97. end
  98.  
  99. animationTrack.Stopped:Connect(onAnimationEnded)
  100. else
  101. print("You do not have the ball to use this ability.")
  102. end
  103. end
  104.  
  105. ability1.MouseButton1Click:Connect(onAbilityClick)
  106.  
  107. local player = game:GetService("Players").LocalPlayer
  108. local playerGui = player:WaitForChild("PlayerGui")
  109. local inGameUI = playerGui:WaitForChild("InGameUI")
  110. local abilities = inGameUI.Bottom.Abilities
  111. local ability2 = abilities["2"]
  112.  
  113. -- Function to copy and change the ability
  114. local function copyAndChangeAbility()
  115. local copiedAbility = ability2:Clone()
  116. copiedAbility.Timer.Text = "Direct Dribble" -- Set the text for the ability
  117. copiedAbility.Parent = abilities
  118. ability2:Destroy() -- Remove the original ability
  119. end
  120.  
  121. copyAndChangeAbility()
  122.  
  123. -- Function to handle the click event for the ability
  124. local function onAbilityClick()
  125. local character = player.Character or player.CharacterAdded:Wait()
  126. local humanoid = character:WaitForChild("Humanoid")
  127.  
  128. -- Animation and sound IDs
  129. local animationId = "rbxassetid://76950247429784"
  130. local soundId = "rbxassetid://76709779075029"
  131. local football = workspace:WaitForChild("Football")
  132. local teleportDistance = 26 -- Distance to check if the player is near the football
  133.  
  134. -- Load the animation
  135. local animation = Instance.new("Animation")
  136. animation.AnimationId = animationId
  137. local animationTrack = humanoid:LoadAnimation(animation)
  138.  
  139. -- Function to check distance and teleport
  140. local function checkDistanceAndTeleport()
  141. while true do
  142. wait(1) -- Check every second
  143. local distance = (character.HumanoidRootPart.Position - football.Position).magnitude
  144.  
  145. if distance <= teleportDistance then
  146. -- Teleport the player to the football's position
  147. character:SetPrimaryPartCFrame(football.CFrame)
  148.  
  149. -- Play the animation
  150. animationTrack:Play()
  151.  
  152. -- Play the sound
  153. local sound = Instance.new("Sound")
  154. sound.SoundId = soundId
  155. sound.Parent = character.HumanoidRootPart
  156. sound:Play()
  157.  
  158. -- Wait for the animation to finish before stopping the sound
  159. animationTrack.Stopped:Wait()
  160. sound:Destroy() -- Clean up the sound after playing
  161. break -- Exit the loop after teleporting
  162. end
  163. end
  164. end
  165.  
  166. -- Start checking distance
  167. checkDistanceAndTeleport()
  168.  
  169. -- Teleport forward function
  170. local function teleportForward()
  171. local forwardDistance = 20 -- Distance to teleport forward
  172. local newPosition = character.HumanoidRootPart.Position + (character.HumanoidRootPart.CFrame.LookVector * forwardDistance)
  173.  
  174. -- Teleport the player to the new position
  175. character:SetPrimaryPartCFrame(CFrame.new(newPosition))
  176.  
  177. -- Play the forward teleport animation
  178. local forwardAnimationId = "rbxassetid://99916870664377"
  179. local forwardAnimation = Instance.new("Animation")
  180. forwardAnimation.AnimationId = forwardAnimationId
  181. local forwardAnimationTrack = humanoid:LoadAnimation(forwardAnimation)
  182. forwardAnimationTrack:Play()
  183.  
  184. -- Play the sound for forward teleport
  185. local forwardSoundId = "rbxassetid://70582458895457"
  186. local forwardSound = Instance.new("Sound")
  187. forwardSound.SoundId = forwardSoundId
  188. forwardSound.Parent = character.HumanoidRootPart
  189. forwardSound:Play()
  190.  
  191. -- Wait for the animation to finish before stopping the sound
  192. forwardAnimationTrack.Stopped:Wait()
  193. forwardSound:Destroy() -- Clean up the sound after playing
  194. end
  195.  
  196. -- Call the teleport forward function
  197. teleportForward()
  198. end
  199.  
  200. -- Connect the click event to the ability button
  201. ability2.MouseButton1Click:Connect(onAbilityClick)
  202. local player = game:GetService("Players").LocalPlayer
  203. local playerGui = player:WaitForChild("PlayerGui")
  204. local inGameUI = playerGui:WaitForChild("InGameUI")
  205. local abilities = inGameUI.Bottom.Abilities
  206. local ability2 = abilities["2"] -- Ensure this is the correct ability reference
  207.  
  208. -- Change the text of the Timer to "Direct Dribble"
  209. ability2.Timer.Text = "Direct Dribble"
  210.  
  211. -- Function to handle the click event
  212. local function onAbilityClick()
  213. local character = player.Character or player.CharacterAdded:Wait()
  214. local humanoid = character:WaitForChild("Humanoid")
  215.  
  216. -- Animation and sound IDs for the teleport to football
  217. local animationId = "rbxassetid://76950247429784"
  218. local soundId = "rbxassetid://76709779075029"
  219. local football = workspace:WaitForChild("Football")
  220. local teleportDistance = 26 -- Distance to check if the player is near the football
  221.  
  222. -- Load the animation
  223. local animation = Instance.new("Animation")
  224. animation.AnimationId = animationId
  225. local animationTrack = humanoid:LoadAnimation(animation)
  226.  
  227. -- Function to check distance and teleport to the football
  228. local function checkDistanceAndTeleport()
  229. while true do
  230. wait(1) -- Check every second
  231. local distance = (character.HumanoidRootPart.Position - football.Position).magnitude
  232.  
  233. if distance <= teleportDistance then
  234. -- Teleport the player to the football's position
  235. character:SetPrimaryPartCFrame(football.CFrame)
  236.  
  237. -- Play the animation
  238. animationTrack:Play()
  239.  
  240. -- Play the sound
  241. local sound = Instance.new("Sound")
  242. sound.SoundId = soundId
  243. sound.Parent = character.HumanoidRootPart
  244. sound:Play()
  245.  
  246. -- Wait for the animation to finish before stopping the sound
  247. animationTrack.Stopped:Wait()
  248. sound:Destroy() -- Clean up the sound after playing
  249. break -- Exit the loop after teleporting
  250. end
  251. end
  252. end
  253.  
  254. -- Start checking distance
  255. checkDistanceAndTeleport()
  256.  
  257. -- Teleport forward function
  258. local function teleportForward()
  259. local forwardAnimationId = "rbxassetid://99916870664377"
  260. local forwardSoundId = "rbxassetid://70582458895457"
  261. local forwardDistance = 20 -- Distance to teleport forward
  262.  
  263. -- Load the forward animation
  264. local forwardAnimation = Instance.new("Animation")
  265. forwardAnimation.AnimationId = forwardAnimationId
  266. local forwardAnimationTrack = humanoid:LoadAnimation(forwardAnimation)
  267.  
  268. -- Calculate the new position
  269. local newPosition = character.HumanoidRootPart.Position + (character.HumanoidRootPart.CFrame.LookVector * forwardDistance)
  270.  
  271. -- Teleport the player to the new position
  272. character:SetPrimaryPartCFrame(CFrame.new(newPosition))
  273.  
  274. -- Play the forward animation
  275. forwardAnimationTrack:Play()
  276.  
  277. -- Play the sound for forward teleport
  278. local forwardSound = Instance.new("Sound")
  279. forwardSound.SoundId = forwardSoundId
  280. forwardSound.Parent = character.HumanoidRootPart
  281. forwardSound:Play()
  282.  
  283. -- Wait for the animation to finish before stopping the sound
  284. forwardAnimationTrack.Stopped:Wait()
  285. forwardSound:Destroy() -- Clean up the sound after playing
  286. end
  287.  
  288. -- Call the teleport forward function
  289. teleportForward()
  290. end
  291.  
  292. -- Connect the click event to the ability button
  293. ability2.MouseButton1Click:Connect(onAbilityClick)
Advertisement
Add Comment
Please, Sign In to add comment