Variable being sent as player name after going through RemoteEvent

LocalScript:

script.Parent.TextButton.MouseButton1Click:Connect(function()
	text = script.Parent.TextBox.ContentText
	LocalPlayer = game.Players.LocalPlayer
	game:GetService("ReplicatedStorage").MessageSent:FireServer(LocalPlayer, text)
end)

Server Script:

game.ReplicatedStorage.MessageSent.OnServerEvent:Connect(function(LocalPlayer, text)
	print(text)
end)

the “print(text)” just prints my username after running the script. Any idea why?

when receiving a remote event, the first argument is ALWAYS the player object that fired the event, remove the

LocalPlayer part and it should work

1 Like