# Proper use of Switch Has Authority

**URL:** <https://forums.unrealengine.com/t/proper-use-of-switch-has-authority/298229>\
**Category:** Platform & Builds\
**Tags:** Networking, custom-event, Switch, unreal-engine, UE4, Blueprint, question\
**Created:** [November 5, 2014, 4:54pm UTC](https://forums.unrealengine.com/t/proper-use-of-switch-has-authority/298229 "2014-11-05T16:54:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_cb27a744](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cb27a744](https://forums.unrealengine.com/u/anonymous_user_cb27a744)\
**Post date:** [November 5, 2014, 4:54pm UTC](https://forums.unrealengine.com/t/proper-use-of-switch-has-authority/298229/1 "2014-11-05T16:54:20Z")

</div>

Hello, sorry if this is a really silly question to ask, but I’ve been messing around with the networking part of blueprints and I’ve somewhat come across a hurdle.

I’ve been trying to make one of the two characters(either server or client) to attach a weapon they find on the ground. The problem was that every time only the server actually saw either the client or himself equipping the weapon, while the client didn’t see anything. After some experimentation I’ve found that if I want the client to equip the weapon, he has to send a request to the server. Eventually I ended up having to use two different replicated functions, one for sending a request to the server and one for multicasting the change to every other player.

 ![20155-switchhas.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/d/71d01c577f338b469f69364833fb2de0be8d8a9c.png)

Here’s the first of my two questions, is this a proper way to do things or am I sending unnecessary load to the server?

The second question is, on which function do I need to use Switch Has Authority ? As you can see in the image, I’m currently using on the first one because it only works there.If I try to use a Switch Has Authority on the second function, it acts as if I’m not sending data to the server. Is this how it’s supposed to be, or am I not sending data properly?

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [November 5, 2014, 6:26pm UTC](https://forums.unrealengine.com/t/proper-use-of-switch-has-authority/298229/2 "2014-11-05T18:26:32Z")

</div>

Switch has authority just tests if the player is the client or the server.

So everything behind “Authority” only gets called if it’s called on the server and everything behind “Remote” gets called if a client uses it. I guess the server itself counts as a client too :X.

If you have a replicated variable, that holds your weapon, you can make a custom event that is called by client and only runs on server (so behind the red node you put the Switch node and take the Authority). If the client knows what he picked up, you could pass the weapon by the custom event inputs and fill the variable with it. If the variable is replicated, you don’t need the multicast i think. This is what you already did i guess?

I don’t know if your variable is set to replicate, so you could try changing this and removing the multicast. If it doesn’t work, then i’m wrong, sorry. (: But at least give it a try. If you current setup works completely fine, i guess you can stick to it.

The best thing to learn the networking system is to watch the networking videos on Youtube, made by Epic. They teach you how to replicate things to other players and much more.

Most of the time i have a twist i my head too, thinking about the networking RPCs.

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [April 15, 2024, 1:42am UTC](https://forums.unrealengine.com/t/proper-use-of-switch-has-authority/298229/3 "2024-04-15T01:42:12Z")

</div>

> [@eXi](#):
>
> if the player is the client or the server.

apparently it doesn’t exactly check for server/client but for owning/not-owning

> [@Am I Server or Client?](https://forums.unrealengine.com/t/am-i-server-or-client/461944/3):
>
> I have finally figured out What HasAuthority actually means after a couple of days of testing. I think this will be very helpful to many people. HasAuthority does not tell you if the instance of the game is the server or the client. It is telling you if the actor you are running the HasAuthority check on belongs to the server or the client. So you can have a game running on a client return true to HasAuthority even if that actor was not spawned by the Client. So as an example - If the server s…

> [@HasAuthority() returning true for Client](https://forums.unrealengine.com/t/hasauthority-returning-true-for-client/54394/9):
>
> If you play in Standalone then there is no networked game - it’s like being a Server without any networking layer. Obviously in Standalone, everything is running on your local machine so HasAuthority() would always be true.

> [@How to check if Client is Listen Server?](https://forums.unrealengine.com/t/how-to-check-if-client-is-listen-server/376681/8):
>
> Great answer. i could not find those nodes in cpp. and IsServer is deprecated but no notice of what to use instead. i’ve been using IsNetMode(NM\_Client) there’s also NM\_Standalone and NM\_Server
