Happy New Years! My sword plays an animation, and once you die, it breaks. The sword damages other players, but there is no animation. The error says, "Cannot load the AnimationClipProvider Service." (Line 24, server script.)
The sword is in StarterPack, and the code fires a remote event to play the animation server-sided. Here's the LocalScript. (The script that fires the remote event, and is in the tool.)
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
-- tool stuff
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local RE = tool:WaitForChild("Activation")
local RE2 = tool:WaitForChild("Activation2")
local sound = handle:WaitForChild("slash")
-- debounce
local on = true
-- module stuff
local RPS = game:GetService("ReplicatedStorage")
local module = RPS.RaycastHitboxV4
local raycastHitbox = require(module) -- raycast
local hitbox = raycastHitbox.new(tool)
local params = RaycastParams.new()
params.FilterDescendantsInstances = {chr, handle}
params.FilterType = Enum.RaycastFilterType.Blacklist
hitbox.RaycastParams = params
local function onTouch(hit, humanoid)
RE:FireServer(humanoid) -- fires to server
end
tool.Activated:Connect(function()
local hum = chr:FindFirstChildWhichIsA("Humanoid")
if hum then
local an = hum:FindFirstChildOfClass("Animator")
if an and hum:GetState() ~= Enum.HumanoidStateType.Dead then
RE2:FireServer(an)
hitbox:HitStart() -- raycast starts
sound:Play()
task.wait(.5)
sound.Ended:Wait()
hitbox:HitStop() -- raycast ends
elseif hum:GetState() == Enum.HumanoidStateType.Dead then
tool:Destroy() -- tool cant be used while dead
end
end
end)
hitbox.OnHit:Connect(onTouch)
Here's the server script. The script that has an error. (The script that receives the remote event, and is in the tool with the animation inside the server script.)
-- tool stuff
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local RE = tool:WaitForChild("Activation")
local RE2 = tool:WaitForChild("Activation2")
-- debounce
local on = true
-- module stuff
local RPS = game:GetService("ReplicatedStorage")
local module = RPS.RaycastHitboxV4
local raycastHitbox = require(module)
RE.OnServerEvent:Connect(function(plr, humanoid)
humanoid:TakeDamage(25) -- damage
end)
RE2.OnServerEvent:Connect(function(plr, an)
local animArray = {script:FindFirstChild("One"), script:FindFirstChild("Two")}
local index = math.random(1,#animArray)
local anim = animArray[index] -- random animation picker
if anim then
local movement = an:LoadAnimation(anim)
movement:Play(0) -- plays animation
end
end)
