A tool that I made always errors whenever I die, so if the tool is unequipped it errors cannot load animationclipprovider service, same thing if it’s equipped, why?
Here is a localscript
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local RaycastHitbox = require(game.ReplicatedStorage.RaycastHitboxV4)
local Hitbox = RaycastHitbox.new(script.Parent.Model.Hitbox)
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {char}
Params.FilterType = Enum.RaycastFilterType.Exclude
Hitbox.RaycastParams = Params
local tool = script.Parent
local slashingsound = script:WaitForChild("SlashingSound")
local slashing = false
local Idle = char:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(script.Idle)
local Slash = char:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(script.Slash)
tool.Equipped:Connect(function()
game.ReplicatedStorage.RemoteEvent1:FireServer(tool.Model.BodyAttach)
char["Right Arm"].ToolGrip.Part0 = char["Right Arm"]
char["Right Arm"].ToolGrip.Part1 = tool.Model.BodyAttach
Idle:Play()
end)
tool.Unequipped:Connect(function()
game.ReplicatedStorage.RemoteEvent2:FireServer()
Idle:Stop()
end)
tool.Activated:Connect(function()
if slashing then return end
Slash:Play()
slashingsound:Play()
Hitbox:HitStart(0.2)
Hitbox.OnHit:Connect(function(hit, humanoid)
print(hit)
humanoid:TakeDamage(34)
end)
slashing = true
wait(2.3)
slashing = false
end)
That means the code never resumes execution… maybe AncestryChanged never fires??
Try this?
if not char.Parent then
char:GetPropertyChangedSignal("Parent"):Wait()
end
Edit: I just remembered something, it may be getting an old character of yours… I am not too sure about a workaround for this, but I’ve experienced that before. Maybe it’d work if you did something like this:
local char = plr.Character
if not char or not char.Parent then
char = plr.CharacterAdded:Wait()
end
Once again, not too sure if this is a functional solution but… maybe?
Edit #2: After testing it in studio on my own, I factually confirmed I can reproduce an issue of getting the old character & this fixing it, hopefully it does for you too.
Its yielding until the local players character is a descendant of workspace. In my code I put the WaitForChild line directly before I load the animation track on my humanoids animator.
hello, i know im pretty late but i know how to fix this issue! all you have to do is: local char = workspace:WaitForChild(plr.Name) and thats how i fixed it!