Server Authority question

I’m trying to understand how exactly networking goes about things. I’m trying to understand if I’m gettings this right.

I have a lift and two vr players. Controls are very simple you only have to put your controller on the trigger zone of the lift panel for it to go up.

What I’m thinking is that I would need the lift to be operated by the server and replicated to the clients, since both can operate the lift. Now how do I go about doing this. Do the hands (just a net transform with a trigger) of the clients replicate to the server (meaning if a client is looking at his hand on the panel, does the hand on the server is still working as intended)? (if so i would just have to turn off the lift panel on the clients side)

And how do I change the position of the player once inside the lift, since depending on just physics would be a mess. Do I have to send a message to the clients so they re position themselves or can the server just move them.

I forgot, If I check isServer && isLocalPlayer would that mean that “I’m” the server and “I” have authority over the script?

I don’t really understand the original question, as I would think VR hands would be local objects for use on the client instead of something you’re syncing across the network. As far as moving a player inside a lift, typically you’d move them on the server and sync those movements with all clients. There’s other ways to do it though where you would do movement ahead of time on the clients.

“if (isServer && isLocalPlayer)” means this computer is the server and this object this script is on is the Player object for this computer. Authority is checked with hasAuthority.

if (isServer && hasAuthority)

The above would match what you were asking in your question.

1 Like

Thanks, and to do that I should not check ServerOnly nor LocalPlayerAuthority on the networkIdentity, right? I mean for a scene object not spawned.

isLocalPlayer is just something for the special Player GameObjects. isServer should be fine for checking if this computer is the server in any NetworkBehaviour script.

Sorry I meant check in the actual component, as in the toggles.

ServerOnly means it should not be spawned on the clients when the server calls one of the Spawn functions after instantiating it. I don’t know what that means for scene objects, but I’d guess it would stay disabled on clients. I’m not sure what would happened with LocalPlayerAuthority checked since you’re not telling it what client is the one with authority. That’s another setting for use with instantiate/spawn methods.

I’d recommend against using networked Scene objects much though, because there’s a good number of unresolved bugs with them that don’t appear will ever be addressed.

Kk thanks man!