I’m making a game where a lot of coins fall, But there’s so many that the server starts lagging.
Is there a way to make these coins only appear for all clients, So the server is lag free?
I’m making a game where a lot of coins fall, But there’s so many that the server starts lagging.
Is there a way to make these coins only appear for all clients, So the server is lag free?
You can spawn the coins on the client, and use RemoteEvents to communicate with the server when players collect these coins. Else, the server won’t be able to keep track of collected coins, therefore not saving in datastores.
Where would i place the localscript that spawns the coins??
StarterPlayer | StarterPlayerScripts
If you want to know the difference between this and StarterCharacterScripts, is that scripts in StarterCharacterScripts will be re-created every time the player’s character spawns, as that is where the script is located. StarterPlayerScripts will parent it’s descendants to the player object, which will only be destroyed when the player leaves.
Okay i got it working, But now the coins don’t get picked up, Since localscripts cant fire touched event…
Any idea on how i’d fix this?
You can set the Network ownership to the player’s client, which should work. If not, you can always measure the distance between the coin and the character’s PrimaryPart using Magnitude
(a Vector3 property).
It says network ownership can only be set on server scripts, Yet the coins get created on the client, So it wouldn’t work right?
I guess i’ll have to do magnitude then.