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"]
- -- Change the text of the Timer to "Knuckle shoot"
- ability1.Timer.Text = "Knuckle shoot"
- -- Function to handle the click event
- 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()
- -- You can add any additional logic here if needed
- end
- animationTrack.Stopped:Connect(onAnimationEnded)
- end
- -- Connect the click event to the ability button
- ability1.MouseButton1Click:Connect(onAbilityClick)
Advertisement
Add Comment
Please, Sign In to add comment