LocalScript (Calling remote function)
for i, player in pairs(game:GetService("Players"):GetPlayers()) do
print(player)
local pd = remoteFunction:InvokeServer(player)
ServerScript (Handles remote event)
print(player.Name)
And now the fun begins:
Client Output:
XX:XX:XX.XXX Player2 - Client - LocalScript:XX
XX:XX:XX.XXX Player1 - Client - LocalScript:X
Server Output:
XX:XX:XX.XXX ▼ Player2 (x2) - Server -ServerScript:XX
XX:XX:XX.XXX Player2
Does someone know what have I done wrong?
1 Like
You don’t have to pass the player as an argument, it is done by default.
Try this:
-- client
remoteFunction:InvokeServer()
-- server
remoteFunction.OnServerInvoke = function(player)
print(player.Name)
end
4 Likes
Thanks for help but It didn’t work.
Why don’t you loop through players in the server? Don’t trust the client.
It is for local gui. Im not trusting the client thats why Im downloading ranks from it
NWhut
(whut)
March 9, 2021, 2:44pm
6
Can you share a bit more of your code? Its kinda hard to understand whats going on
1 Like
NWhut
(whut)
March 9, 2021, 2:45pm
7
and check if you did a return
in the remote function
I know what happened!
ServerScript was using player value but the first player value! As @GAFFAL_1236 said, it passes the local player at the first argument so when I started to use the second one (which was also user but different) it works!
1 Like