Whenever I equip my weapon, an animation plays. here is my "SERVER" script for later references:
script.Parent.nowits6rlly.OnServerEvent:Connect(function(Player, State)
local animation = script.Parent:WaitForChild('On')
local humanoid = Player.Character:WaitForChild("Humanoid")
local On = humanoid:LoadAnimation(animation)
if State == "On" then
On:Play()
On.Looped = true
elseif State == "Off" then
On:Stop()
On.Looped = false
end
end)
script.Parent.RayCastEvent.OnServerEvent:Connect(function(Player)
local animation = script.Parent:WaitForChild('Shoot')
local humanoid = Player.Character:WaitForChild("Humanoid")
local Shoot = humanoid:LoadAnimation(animation)
Shoot:Play()
end)
script.Parent.RELOAD.OnServerEvent:Connect(function(Player)
local animation = script.Parent:WaitForChild('Reload')
local humanoid = Player.Character:WaitForChild("Humanoid")
local Reload = humanoid:LoadAnimation(animation)
Reload.Looped = false
Reload:Play()
end)
The script works until I unequip it, when it gives me the error. Here is the "LOCAL" script that sends the function when I unequip:
script.Parent.Unequipped:Connect(function()
Mouse.Icon = "rbxasset://SystemCursors/Arrow"
AnimationStatus = "Off"
script.Parent.nowits6rlly:FireServer(AnimationStatus)
end)
EDIT: The error is gone, but the animation still wont stop. EDIT: I made a typo and fixed it by saying local script and not script.

9 comments
It means the variable
LocalPlayeris nilI know but i dont know why LocalPlayer sets to nil after unequipping
just change
LocalPlayertoPlayer, you don't need that 3rd argument, it only opens your code for exploitersoh thx
good news! no more error, but now the animation just wont stop.
Did you mean On.Looped = false at line 10? Make sure it's . not :
Pupppy44's method did not work.
Use Animation:Stop()
Already solved it