I need help with how to alter ReplicatedStorage from a LocalScript
I want to add RemoteEvent Instances to the ReplicatedStorage from a LocalScript and have it replicate to the server and other clients
How can I do this?
LocalScripts only add instances to the client, so there is no way of adding new ones from a LocalScript. Try making a separate RemoteEvent to a server script that will then create your RemoteEvents which will then be replicated between the server and all clients.
Thanks for the quick reply but I actually found the solution (don’t worry, I’m not dealing with any sensitive information, I’m just making certain sound effects play)
I just need to make events from a ServerScript and fire them from a LocalScript
You’re not able to really protect your RemoteEvents, you will need to add server prevention methods, such as verification if statements ect, lets act as if I am a player, and I am attempting to redeem an item, or purchase an egg, I would create some form of value or something on the server that I would tick whilst the egg unboxing is occuring, then wait a second or two ( till the clients’ egg animation is over, we have to time it in a sense ), but essentially add a form of cooldown on the server, so the client isn’t able to spam the remote and buy a bunch of eggs, this is just an example, but take it as you wish. It’s best to use proper methods when creating a server and client, to prevent exploiters from hitting a remote and taking advantage of it.
I understand that exploiters can fire RemoteEvents if they’re in ReplicatedStorage if they find them but exploiters won’t be able to do anything other than spam a sound effect if they get their hands on it
To give some context, I’ll tell you what the script does:
I created a gun tool (it’s a prop and does no damage) for a game and I made it play a sound whenever it’s fired
There is a lot of complicated (maybe badly written because I am still learning Luau) code that deals with playing animations (reloads, firing, etc.) and my sound effect is the fire sound. It is relatively quiet and since it usually fires fast anyway, I don’t think anybody would be bothered even if it was spammed up to 900 times per minute (because that’s how many rounds an M16A2 rifle shoots)