Hi, we're trying to figure out a way to make an animation play when equipping a tool. We followed a tutorial on youtube for this originally, which resulted in it doing nothing. We then changed a bit of code, and it still isn't working.
We used the code under the tool to fire the server:
local AbilityEvent = game.ReplicatedStorage.Char1Ability1
script.Parent.Equipped:Connect(function()
AbilityEvent:FireServer()
end)
and then had a code in ServerScriptService to play the animation:
local AbilityEvent = game.ReplicatedStorage.Char1Ability1
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetId://18313934030"
AbilityEvent.OnServerEvent:Connect(function(plr)
local char = game.Workspace:FindFirstChild(plr.Name)
local hum = char.Humanoid
local animTrack = hum:LoadAnimation(Animation)
animTrack:Play()
end)