Yes, you can see server side whether a player has a weapon equipped, but it’s more difficult then just doing it client side tbh. Client side, it’s like you showed with the function (without the player), but server side, you would need to check whether the tool is in the backpack of the player (How do I check if a tool is equipped? - #2 by BasedKnowledge).
So personally, I would do it client side. If you need information from the server when you equip the weapon, you can get that by making a remote function.