![]() ![]() from the server side part of the function. If I need to give data to a single client, I always found it made more sense to have the client ask for that information first using a RemoteFunction, where instead of the server having to do RemoteFunction:InvokeClient(player. On a sidenote, I’ve never found a need to send data to any particular client from the server. For example: game:GetService('Players'):GetPlayerFromCharacter(workspace.pranvexploder) It can be used only if you know who the character is and want to have its player. ![]() Where Roblox automatically removes the Player argument, since the client doesn’t need it. GetPlayerFromCharacter() is a function which will help you get the player if you have its character. The client code will receive it like this: Remote.OnClientEvent:Connect(function(inventory) Similarly, if I wanted to send some save data to an individual client, my server code would look something like this: local Player = The Player who fired that remote is automatically added there by Roblox. The server will receive it like this: Remote.OnServerEvent:Connect(function(Player, cameraPos) You can see it here: Players Documentation - Roblox Creator Hub A service that contains presently connected Class.Player objects. Something to understand about RemoteEvents and RemoteFunctions is that they prepend a Player argument when the server is receiving, and you have to prepend a Player argument yourself when your server code is sending information to individual clients (unless you’re using RemoteEvent::FireAllClients).įor example, here’s some client code that sends the local player’s camera position to the server: local cameraPos = GetPlayerFromCharacter () is a method of Players Service. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |