Just to confirm, for me to call a function between Server and LocalScript and vice versa, will I have to have a RemoteFuncion or RemoteEvent for each function?
Does this mean that if I have 100 functions, I will have to create 100 RemoteFuncion/Event for each one, in ReplicateStorage?
You could put them all in a dictionary and send the option for the script to look it up
Server:
local Options = {}
function Options.Hi(Player, ...)
print("hi", Player, ...)
end
function Options.Bye(Player, ...)
print("bye", Player, ...)
end
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player, Option, ...)
local Function = Options[Option]
if not Function then print("Invalid") end
local Success, Err = pcall(Function, Player, ...)
if not Success then print(Err) end
end)
Using a separate remoteevent/-function for each function also works fine, it’s mostly up to preference, but I would say passing an argument like in the example above is much cleaner.