Script that makes character animate when a tool is activated and the mouse is clicked not working

In ServerStorage, I have a tool (its a sunscreen bottle) and inside i have 2 scripts and an animation inside the script and a remote event inside of it:
Screen Shot 2021-08-19 at 3.12.26 PM

Script:

local Tool = script.Parent
local Animation = script:FindFirstChild("Animation")
local player = script:FindFirstAncestorWhichIsA("Player") or game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local character = player.Character or player.CharacterAdded:Wait()
local AnimationTrack = character:WaitForChild("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(Animation)
AnimationTrack.Priority = Enum.AnimationPriority.Action

script.Parent.Applying.OnServerEvent:Connect(function(mouseHit)
	AnimationTrack:Play()
end)

LocalScript:

local tool = script.Parent
local re = tool:WaitForChild("Applying")


local mouse = game.Players.LocalPlayer:GetMouse()


tool.Activated:Connect(function()

	re:FireServer(mouse.Hit)
end)

Why are you playing the animation on the server? you can just play the animation in the local script itself,
animations replicate.

local player = game.Players.LocalPlayer

repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

local tool = script.Parent 

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://id here"

local loaded = humanoid:LoadAnimation(animation)

tool.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()
		loaded:Play()
	end)
end)
1 Like

I got rid of the remote event and the other script and just used this but it still didn’t do anything when I had the tool equipped and clicked

Any errors? ( character limit )

I personally never use that property so I didnt know it returned an error just remove that line and everything should be fine. If you want the animation to be ontop of everything just change it from the animation editor itself.

I did both things but its still not working this time I have no errors tho