local uis = game:GetService('UserInputService')
local players = game:GetService('Players')
local plr = players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local tool = script.Parent
local debounce = script.Parent.debounce
local debounce2 = true
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local myAnimation = Instance.new("Animation")
myAnimation.AnimationId = "rbxassetid://11844419528" -- 0.55 seconds long
animationTrack = animator:LoadAnimation(myAnimation)
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and debounce.Value and debounce2 then
debounce2 = false
if humanoid.Health > 0 and char.Parent ~= nil then
animationTrack:Play()
wait(0.2)
game.ReplicatedStorage.events.swordevent:FireServer('equip')
wait(0.6)
debounce2 = true
end
end
end)
Code runs fine the first time but when player resets the error: Cannot load the AnimationClipProvider Service happends. It is a local script under a tool in starter pack.