I am trying to avoid using RemoteEvents because they seem to have the problem of not going through if there is lag on the server, I have better luck with things going through with RemoteFunctions but is there a way to make a RemoteFunction fire to all players similar to how a RemoteEvent can?
It will not make sense to have RemoteFunction
have some sort of InvokeAllClients()
function. Since RemoteFunctions have to return something, how would the script store and process the result from multiple clients?
You're better off invoking it for each client manually. To prevent one invoke from blocking another, you can wrap each call in a spawn()
:
-- In a server script for _, player in pairs(game:GetService("Players"):GetPlayers()) do spawn( function() local returnVal = RemoteFunction():InvokeClient(player, arguments) -- process returnVal here end ) end
Hi! As Far as I know yes, RemoteFunctions can fire to all Clients...RemoteFunctions
and RemoteEvents
are both very Similiar, but the main and biggest difference is that in Remote Functions not only can the Server "Fire" to the Client, the Client can also "call back" and give a message back in the same Remote Function...But, Despite what you said about the lag...it is recommended that you use RemoteEvents over RemoteFunction, unless you need the Client or the Server to call back in the same Function.. More information over Remote Funtions here- http://wiki.roblox.com/index.php?title=API:Class/RemoteFunction Remote Functions also use the onClientInvoke
instead of the onClientEven
t like the RemoteEvent.. Hope this helped! Let me Know if it did! The Wiki has a lot more helpful information about this, check there!
im not rlly sure what that is, so i cant help, but try putting a script in starterplayer, wich goes in the player that is in workspace