Remote event but with multiple functions?

Is it possible to use one Remote Event but with multiple functions if it is can someone give me an idea on how to execute it.

1 Like

It’s very simple, just pass an argument. I usually do the arguments, on the server for example, plr,job,msg
On the client is the same but without plr as the player isn’t an argument when fired to the client.

For example, just do this (works vice versa)

--Local Script
game.ReplicatedStorage.RemoteEvent:FireServer("acceptRequest", args) -- args is the rest of the arguments, can be an array, dictionary, or just more arguments
--Script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,job,msg)
   if job == "acceptRequest" then
      -- do stuff
   elseif job == "idkWhat" then
      --do other stuff
   end
end)
5 Likes

You could do the functions on the server side and once you have the result, you can fire the client with the results.

2 Likes

But I have a feeling that exploiters can still use this to exploit once they found out what is the argument to fire a certain function on the server script. Like if one of the argument is "giveMoney" then exploiter could just use a tool to fire ther server with this argument event:FireServer("giveMoney")

Unfortunately it’s hard to get around exploiters firing the server for money. Maybe you could try checking how often they are firing the server to give themself money, and if it exceeds a limit then kick them or send them a warning. Probably just patch the exploits as they come up, for now I would focus on making your game as good as you can.

Currently I’m focusing on the scripts and in my game I really don’t want to use RemoteEvent because I don’t really trust it.

It is not possible to get player input without RemoteEvents.

1 Like

Well, without an argument it’s just firing the function. With an argument it’s firing the function with a specific argument.
Regardless, you should ALWAYS do background checks when adding money and anything important.

How do I background check I don’t get what your saying can you please explain it to me so I can understand I really wanna make the money system safe.

1 Like

Well, not “background check” by its exact meaning.
Employ anti-exploit measures, check how often it’s added, require more information that the player doesn’t have access to to make it safer. It depends from game to game, but just add some checks so it’s not just firing the event.

Can’t really tell you any good option since it’s really based on how the game is programmed

1 Like

Oh I see, what about ServerStorage Its a server storage right since the server can only see it but not the players.

Depending on what you’re planning to do with it, it might work.
But just remember, if you’re checking for a value to confirm that money can’t be added, the client cannot send a value it doesn’t have access to.

1 Like