I Have a question about ServerScript Performace and Events

So I have a Serverscript in ServerScirptService that runs when a ProximityPrompt gets triggered, I have a lot of ProximityPrompts in my game, my question is that is making one code do all the work better than putting individual codes inside the ProximityPrompt? and does events get replicated like the event ProximityPrompt.Triggered? so that when another person in the server Triggers a ProximityPrompt and another again Triggers, it wont cause issue?

Also the contents in my scripts does not stop immediately if the event happens it still waits minutes to run a code in the script again.

To give you more idea: my game is like a simulator, in my game you collect things they shrink with tweenservice then you gain points and then after minutes they growback again with tweenservice. That one script in ServerScriptService does all this work to all clients in the game.

I recommend doing all the tweening on the client, what you could do is run the scripts on individual clients. Fire a RemoteEvent whenever someone triggers the ProximityPromt. When it gets triggered you should tween it on that client and just simply destroy it on the server which means the server does not get affected by the tween only the player that grabbed the coin or anything.

Ok, but I intended it to be tweened on the server so other players can also see it(see the plant grow), should I just give up this feature or is there anything I can do to optimize it without tweening it on the client

You can make it grow on the server, but not make it look smooth which means on the server it will just add size to the plant. And on the client (the player who placed down the plant) will see it grow smooth.

1 Like

ok thankyou very much, ill implement that