So basically when I try to send a message to the server from the client using a remote event, no matter what variable, value or string I send the server receives it as my roblox user name. Also when I try to read a value it prints nil even though the value clearly has something in it. This only started happening today.
can you show me the scripts, maybe i can help?
When you fire a RemoteEvent from the client using FireServer
, the first argument the server recieves in OnClientEvent
will the the Player
who fired the event.
So for example if a LocalScript fires a RemoteEvent and passes an argument into the FireServer
method, the Script would want to connect to the event looking something like this:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(player, arg1)
--arg1 will be the value you passed in from LocalScript
end)
Quick correction that I assume was just a typo; the server would be listening for OnServerEvent
to fire as a result of :FireServer()
calls that were made by clients in the game.
To clarify for OP, OnClientEvent
would be used in client-sided / local scripts so that the client knows when the server wants to communicate something (either through RemoteEvent:FireClient(player)
for a specific player, or RemoteEvent:FireAllClients()
for all players simultaneously).
Ahh yep, thats what I get for writing code blocks from my phone. Thanks for the correction and clarification!