Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

(Solved) Event prints out username only?

Asked by
zane21225 243 Moderation Voter
4 years ago
Edited 4 years ago

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.

0
hey can i have the won where it prints the username Jakob_Cashy 79 — 4y
0
so i can put different player usernames into textbox Jakob_Cashy 79 — 4y
0
^ What do you mean? zane21225 243 — 4y

1 answer

Log in to vote
1
Answered by
iOwn_You 543 Moderation Voter
4 years ago

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.

0
Thanks for the help. Is it possible for me to just do one parameter as the player, instead of 2? zane21225 243 — 4y
0
Nevermind. I got it working. Thanks for the help, lad! zane21225 243 — 4y
Ad

Answer this question