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

RemoteEvent: How do I send a .Text as an argument ?

hai! When I send the following to a RemoteEvent, I get an error where it says a String was expected for argument 2. How can I send something like this?

local player = game.Players.LocalPlayer
local player2 = script.Parent.Parent.user.Text
game.ReplicatedStorage.aaa:FireServer(player, player2)

1 answer

The function :FireServer() does not require a player argument unlike the :FireClient() function which does, therefore the corresponding event .OnServerEvent does return a player in the first argument, after this would be any thing you sent over as well.

The problem with your script is because this function doesnt require a player argument you are sending two things to the server, the player and example. The most likely cause of your problem is that on the receiving end of this you are assigning the first returned value expecting it to the the string but it is actually the player, then the next value would be that string.

tl;dr

local example = script.Parent.Parent.user.Text
game.ReplicatedStorage.aaa:FireServer(example) --doesn't need player

2 comments

0

thank you! ;p

0

@ShallowGrouchyAdrian accept answer?

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