local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://16188791182"
local isplaying = false
local plr = game.Players.LocalPlayer
local replicatedStorage = game.ReplicatedStorage
local fireBlast = replicatedStorage.fireBlast
player.CharacterAdded:Wait()
local ClassicSword = player.Backpack.ClassicSword
local toolEquipped = false
local function onToolEquipped()
toolEquipped = true
end
local function onToolUnequipped()
toolEquipped = false
end
local function onKeyPress(input)
local direction = workspace.CurrentCamera.CFrame.LookVector
if input.KeyCode == Enum.KeyCode.R then
if isplaying == false and toolEquipped then
isplaying = true
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local animplay = humanoid:LoadAnimation(animation)
animplay:Play()
animplay.Stopped:Connect(function()
isplaying = false
end)
fireBlast:FireServer(direction)
end
end
end
userInputService.InputBegan:Connect(onKeyPress)
ClassicSword.Equipped:Connect(onToolEquipped)
ClassicSword.Unequipped:Connect(onToolUnequipped)
my animation stops half way threw.