Alright, so I've got an interesting issue. The script and animations actually work just fine, and everything does what it's supposed to. However, every time I fire the gun this is for, this error pops up despite everything working fine. 18:14:32.032 - LoadAnimation requires an Animation object

Here's the script:

game.ReplicatedStorage.Equipped.OnServerEvent:Connect(function(player, animation)
	local newAnim = game.Workspace[player.Name].Humanoid:LoadAnimation(animation)
		newAnim:Play()
		game.ReplicatedStorage.Unequipped.OnServerEvent:Connect(function()
			newAnim:Stop()
	end)
end)

game.ReplicatedStorage.Fire.OnServerEvent:Connect(function(player, animation)
	local fireAnim = game.Workspace[player.Name].Humanoid:LoadAnimation(animation)
	script.Parent.Handle.FireSound:Play()
	fireAnim:Play()
end)

game.ReplicatedStorage.Reload.OnServerEvent:Connect(function(player, animation)
	local reloadAnim = game.Workspace[player.Name].Humanoid:LoadAnimation(animation)
	script.Parent.Handle.ReloadSound:Play()
	reloadAnim:Play()
end)

This error is incredibly annoying to deal with, and just generally makes the gun feel like it's broken somehow. Thanks!

3 comments

0

Does this error affect other clients from seeing the animation?

0

Check out the animation for the gun. It seems to not exist, as it says it requires a animation object in order to load it.

0

It seems to affect everyone, including the local client. Interestingly, the animations still show up in Studio.