Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game:GetService("Players").LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- local inGameUI = playerGui:WaitForChild("InGameUI")
- local abilities = inGameUI.Bottom.Abilities
- local ability1 = abilities["1"]
- local function copyAndChangeAbility()
- local copiedAbility = ability1:Clone()
- copiedAbility.Timer.Text = "Knuckle shoot"
- copiedAbility.Parent = abilities
- ability1:Destroy()
- end
- copyAndChangeAbility()
- local function onAbilityClick()
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local animationId = "rbxassetid://122513708013347"
- local soundId = "rbxassetid://87838758006658"
- local animation = Instance.new("Animation")
- animation.AnimationId = animationId
- local animationTrack = humanoid:LoadAnimation(animation)
- animationTrack:Play()
- local function fireRemoteAndPlaySoundHalfway()
- local animationLength = animationTrack.Length
- wait(animationLength / 2)
- local sound = Instance.new("Sound")
- sound.SoundId = soundId
- sound.Parent = character
- sound:Play()
- local args = {
- [1] = 200,
- }
- game:GetService("ReplicatedStorage").Packages.Knit.Services.BallService.RE.Shoot:FireServer(unpack(args))
- end
- fireRemoteAndPlaySoundHalfway()
- local function onAnimationEnded()
- animationTrack:Stop()
- end
- animationTrack.Stopped:Connect(onAnimationEnded)
- end
- ability1.MouseButton1Click:Connect(onAbilityClick)
- local player = game:GetService("Players").LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- local inGameUI = playerGui:WaitForChild("InGameUI")
- local abilities = inGameUI.Bottom.Abilities
- local ability1 = abilities["1"]
- ability1.Timer.Text = "Knuckle shoot"
- local function onAbilityClick()
- local character = player.Character or player.CharacterAdded:Wait()
- local hasBallValue = character:FindFirstChild("Values") and character.Values:FindFirstChild("HasBall")
- if hasBallValue and hasBallValue.Value then
- local humanoid = character:WaitForChild("Humanoid")
- local animationId = "rbxassetid://122513708013347"
- local soundId = "rbxassetid://87838758006658"
- local animation = Instance.new("Animation")
- animation.AnimationId = animationId
- local animationTrack = humanoid:LoadAnimation(animation)
- animationTrack:Play()
- local function fireRemoteAndPlaySoundHalfway()
- local animationLength = animationTrack.Length
- wait(animationLength / 2)
- local sound = Instance.new("Sound")
- sound.SoundId = soundId
- sound.Parent = character
- sound:Play()
- sound.Ended:Connect(function() sound:Destroy() end) -- Clean up sound after it finishes
- local args = {
- [1] = 200,
- }
- game:GetService("ReplicatedStorage").Packages.Knit.Services.BallService.RE.Shoot:FireServer(unpack(args))
- end
- fireRemoteAndPlaySoundHalfway()
- local function onAnimationEnded()
- -- You can add any logic here if needed when the animation ends
- end
- animationTrack.Stopped:Connect(onAnimationEnded)
- else
- print("You do not have the ball to use this ability.")
- end
- end
- ability1.MouseButton1Click:Connect(onAbilityClick)
Advertisement
Add Comment
Please, Sign In to add comment