So, basically I am working on a FPS game, and I made a custom tool system of my own. Now, for whatever reason ( not sure if this was happening before I switched or not ), when a player switches to a different weapon, all the other players' animations stop. I've tested this in a live game and in studio.
This is the code in a server script. There's nothing wrong on the client end, trust me lol.
replicatedStorage.Weapons.Melee.MeleeSwingEvent.OnServerEvent:Connect(function(player, tool, animation) local fireAnim = tool.Parent.Humanoid:LoadAnimation(animation) fireAnim:Play() tool.WeaponDetails.Swinging.Value = true tool.FireSound:Play() end) replicatedStorage.Weapons.EquipAnimation.OnServerEvent:Connect(function(player,animation, idleAnimation, tool) local newAnim = workspace[player.Name].Humanoid:LoadAnimation(animation) newAnim:Play() local idleAnimationLoaded = workspace[player.Name].Humanoid:LoadAnimation(idleAnimation) idleAnimationLoaded:Play() tool.EquipSound:Play() replicatedStorage.Weapons.UnequipAnimation.OnServerEvent:Connect(function(player) newAnim:Stop() idleAnimationLoaded:Stop() for i,v in pairs(workspace:GetChildren()) do if v.Name == player.Name.."'s Trajectory" then v:Destroy() end end end) replicatedStorage.Weapons.Reload.OnServerEvent:Connect(function(player,animation) if animation.Parent.ReloadSound.Playing == false then animation.Parent.ReloadSound:Play() local reloadAnim = workspace[player.Name].Humanoid:LoadAnimation(animation) reloadAnim:Play() end end) end)
Your problem might be that
replicatedStorage.Weapons.Melee.MeleeSwingEvent.OnServerEvent:Connect(function(player, tool, animation) local fireAnim = tool.Parent.Humanoid:LoadAnimation(animation) fireAnim:Play() tool.WeaponDetails.Swinging.Value = true tool.FireSound:Play() end) replicatedStorage.Weapons.EquipAnimation.OnServerEvent:Connect(function(player,animation, idleAnimation, tool) local newAnim = workspace[player.Name].Humanoid:LoadAnimation(animation) newAnim:Play() local idleAnimationLoaded = workspace[player.Name].Humanoid:LoadAnimation(idleAnimation) idleAnimationLoaded:Play() tool.EquipSound:Play() -- you're missing some ends here --[[ replicatedStorage.Weapons.UnequipAnimation.OnServerEvent:Connect(function(player) newAnim:Stop() idleAnimationLoaded:Stop() for i,v in pairs(workspace:GetChildren()) do if v.Name == player.Name.."'s Trajectory" then v:Destroy() end end end) replicatedStorage.Weapons.Reload.OnServerEvent:Connect(function(player,animation) if animation.Parent.ReloadSound.Playing == false then animation.Parent.ReloadSound:Play() local reloadAnim = workspace[player.Name].Humanoid:LoadAnimation(animation) reloadAnim:Play() end end) end) Meaning that you're connecting all of this.]]
Try reconnecting the events with their proper endings and do NOT use the code above, for I commented most of it rendering it useless