RemoteEvent won't use passed argument and will just print player name?
Asked by
8 years ago Edited 8 years ago
I don't get this. Take a look:
I have a localscript named "Test" here it is:
1 | local modules = game.Workspace [ "Module(s)" ] ; |
2 | local chathandler = require(modules.ChatHandler); |
4 | local msg = ( "I love icecream." ); |
6 | chathandler.test(game.Players.LocalPlayer,msg); |
I have a modulescript, here's how it looks in relation to that code:
1 | function chathandler.test(player,msg) |
2 | chatAdd:FireServer(player,msg); |
Now here's the RemoteEvent which should print the msg correctly:
1 | chatAdd.OnServerEvent:connect( function (player,msg) |
What's going on? Why does it print the Player's name but not the msg itself? Is it not passed correctly?
EDIT (Update, just uses msg this time): Still doesn't work.
New localscript:
1 | local modules = game.Workspace [ "Module(s)" ] ; |
2 | local chathandler = require(modules.ChatHandler); |
4 | local msg = ( "I love icecream." ); |
Modulescript:
1 | function chathandler.test(msg) |
2 | chatAdd:FireServer(msg); |
RemoteEvent:
1 | chatAdd.OnServerEvent:connect( function (msg) |