A problem about remote functions

Hello !

Today, I learnt how create databases and how to use them correctly.

But, I have a problem transmitting values through the function, here’s my script :

(the script is saving player’s graphic configurations)

Client-side

Server-side

The problem is variable “player” is identical of “choosedBoolean”, which are different variables.

The both variables:
3 4

Thanks for answering !

When firing a remote from the client, the LocalPlayer is automatically passed. When you call game.ReplicatedStorage.SavePreferences:InvokeServer(plr, isSavingPreferences) you’re actually sending the player to the server twice.

This would be correct correct:

game.ReplicatedStorage.SavePreferences:InvokeServer(isSavingPreferences)
game.ReplicatedStorage.ShowAgainFunc:InvokeServer(isShowingAgain)
2 Likes

It still returns me the player, is it normal?

Yes, the server should be receiving the player as the first argument.

When you fire a remote event or function to the server, it will automatically pass the player. So, if you did this

remoteFunction:InvokeServer("hello world!")

The server will get this.

remoteFunction.OnServerInvoke = function(player, message)
    print(player.Name, "sent this:", message) --> "Player sent this: hello world!"
end
1 Like

The wiki is a good place to look as it tells you everything that RemoteFunctions and events do with being fired, or just in general.

Custom Events and Callbacks | Documentation - Roblox Creator Hub

I just linked to the wiki and said it’s a good place to look because people already answered his question.

1 Like