Remote Event Trouble

I am currently making a Voting system but I ran into a problem. My UI detects clicks from the client, which then goes to the server to finalize the full number of votes. But I ran into this problem with my Remote event attribute.

The Remote Event had two attributes, Player, and VotingName. The VotingName would be the Map the player was voting for and the Player would be the Player that voted for the Map. Here is what happened:

I put the Player into the input, and the Server got the player, but then I put the string in the input, and it still got the player. Here is my scripts.

Client:

______________________________________^^ Player ______________________^^ String
Server:

_____________________________________________________________________^ Player __^ String

See how they have the same values sent and received? Well now lets see what the server receives.

image_2024-07-16_121836591
Just the Player when it was supposed to receive a string as well.

How can I make the Server receive the string as well?

When firing to a server through a RemoteEvent, the player variable automatically comes as the first parameter in the server. So, to fix your problem, you’ll want to do the following (on the client):

(...)VoteController:FireServer(script.Parent.Parent.Name) -- the server will automatically receive the player as the first parameter.

If you want to read up on this, the reason of it is because of how object oriented programming (OOP) works in Lua.
Hope this helps!

1 Like

Thank you! Character limit

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.