I'm not sure what's happening, anyone know why?
This is the local script:
script.Parent.RemoteEvent:FireServer("TestString")
Server side script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(String) print(tostring(String)) end)
Instead of returning the string it instead returns the client's player?
Output reads: "wwwaylon09"
The local script, server side script, and remote event are all parented to a tool. Possibly a replication error?
Edit: I moved the remote event to replicated storage and the server side script to the workspace yet it still receives the client instead of the string.
For any client to server communication through remotes, the first tuple passed is ALWAYS the player that triggered the remote.
The solution is to make the first tuple received either a dummy variable - put an underscore in its place - or initialise it as player
:
-- local script remoteEvent:FireServer(string) -- server script remoteEvent.OnServerEvent:Connect(function(_, string) -- you could very well replace '_' with 'player' print(string) end)