Your code ran on one machine. The others never heard about it.

The problem
The sound plays where the code runs.
protected override void OnUpdate(){ if ( IsProxy ) return; if ( Input.Pressed( "attack1" ) ) Sound.Play( "explosion", WorldPosition );}
Only the owner gets past IsProxy, so only the owner plays the sound.
The fix
Send the moment to everyone.
Mark a method [Rpc.Broadcast]. Calling it runs it on every machine in the game, yours included.
one call→[Rpc.Broadcast]→runs everywhere
The fix in code
Call it like any method.
protected override void OnUpdate(){ if ( IsProxy ) return; if ( Input.Pressed( "attack1" ) ) Explode( WorldPosition );} [Rpc.Broadcast]void Explode( Vector3 where ){ Sound.Play( "explosion", where );}
The owner decides when. Every machine plays the sound.
Which one?
A value, or a moment?
| [Sync] | [Rpc.Broadcast] | |
|---|---|---|
| For | a value that stays | something that happens |
| Example | IsSliding, Health | a sound, a spark |
| Late joiner | gets the value | missed it |
If a player joining late should still see it, it's a value. Sync it.
The rule
A value? Sync it. A moment? Broadcast it.
- A value
- [Sync]
- Something that happens
- [Rpc.Broadcast]
- Who calls it
- the owner