I have a localscript that sometimes tells a serverscript to do some stuff. This localscript also sometimes requests something from that serverscript. The localscript and serverscript look something like this:
Localscript:
local Functions = {
Function1 = function()
RemoteFunction:InvokeServer(args)
end,
Function2 = function()
local Result = RemoteFunction:InvokeServer(args)
end
}
Bindable.Event:Connect(function(FunctionName)
Functions[FunctionName](args)
end)
ServerScript
local Functions = {
Function1 = function()
--do some stuff
end
Function2 = function()
--do some stuff
return Result
end
}
RemoteFunction.OnServerInvoke = function(FunctionName)
Function[FunctionName](args)
end
So currently the LocalScript is firing a remotefunction always even though it doesn’t always want something back from the server. My question is: is it better to have a remoteEvent that tells the server to do something and have the remotefunction only if the LocalScript wants some information back? And if so why? If you have any questions feel free to ask.