Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

(Solved) Event prints out username only?

Hello all.

I am trying to use Events to send information, in this case being what a player enters into a TextBox.

For some reason, both of the instances I refer to when I call the event, both come out as the player's username when only one of them should.

Here's the script that triggers the event:

script.Parent.MouseButton1Click:Connect(function()
	workspace.PrintThingy.RemoteEvent:FireServer(player.Name, 	 tostring(script.Parent.Parent.Username_2.Text))
end)

Here's the script that receives the information:

local function typed(username, text)
	print(tostring(username)..' has typed into the TextBox: '..text)
end

script.RemoteEvent.OnServerEvent:Connect(typed)

I am not seeing the issue here.

3 comments

0

hey can i have the won where it prints the username

0

so i can put different player usernames into textbox

0

^ What do you mean?

1 answer

✓ Accepted answer

Your issue is that remote events send the first parameter as player, so it would be (player,username,text) Which means you dont have to send the username, it sends it regardless, you can do player.Name on the server to get the username.

2 comments

0

Thanks for the help. Is it possible for me to just do one parameter as the player, instead of 2?

0

Nevermind. I got it working. Thanks for the help, lad!

This discussion is preserved as it was. New answers, comments, and votes are closed.