RemoteEvent/Object error

Hello, there fellow developers! I am working on a GUI to where it has two textboxes. Once you click the submit button, it should fire the server with the arguments inside of the parenthesis. This step of the process worked successfully, it has sent to a server script after being fired, in order to send back to the client(which is the person holding the item). When they hold the card, it displays whatever the arguments that were written in the 1st GUI. Which was sent to the server which was sent to the client.

Here is the 1st local script that works fine:

local RS = game:GetService("ReplicatedStorage")
local DisplayRE = RS:WaitForChild("SteveHarveyCard"):WaitForChild("DisplayMessages")
local GuiDestroyRE = RS:WaitForChild("DestroyGUI")

--Declarations--
local screenGUI = script.Parent
local pcScreen = script.Parent.Computer:WaitForChild("Screen")
local submitButton = pcScreen.SubmitFrame.SubmitButtonScreen:WaitForChild("Submit")
local QuestionTextbox = pcScreen.QuestionFrame.QuestionLabel:WaitForChild("QuestionTextbox")
local roundType = pcScreen.RoundType.RoundFrame:WaitForChild("TextBox")
local exitButton = pcScreen:WaitForChild("ExitButton")

submitButton.MouseButton1Down:Connect(function()
	print("I want to send the info to the card")
	DisplayRE:FireServer(roundType.Text, QuestionTextbox.Text)
	print("Yeey I sent it!")
	GuiDestroyRE:FireServer(game.Players.LocalPlayer.Name, "CardInfoCustom")
	screenGUI:Destroy()
	print("I just destroyed myself!!!")
end)

Here is the script that is getting there:


local RS = game:GetService("ReplicatedStorage")

local DisplayRE = RS:WaitForChild("SteveHarveyCard"):WaitForChild("DisplayMessages")

DisplayRE.OnServerEvent:Connect(function(plr, roundType, question)

DisplayRE:FireClient(roundType, question)

print("Sent the question and round type to the client.")

end)

And here is the last and final local script that is taking the data collected from the client:


local RS = game:GetService("ReplicatedStorage")

local DisplayRE = RS:WaitForChild("SteveHarveyCard"):WaitForChild("DisplayMessages")

--Declarations--

local tool = script.Parent

local player = game.Players.LocalPlayer

local cardInfo = script.Parent:WaitForChild("CardInfo")

local RoundTypeTextBox = cardInfo.Card.Screen.RoundTypeFrame:WaitForChild("RoundTypeTextBox")

local QuestionTextBox = cardInfo.Card.Screen.QuestionFrame:WaitForChild("QuestionTextBox")

DisplayRE.OnClientEvent:Connect(function(plr, roundType, question)

RoundTypeTextBox.Text = roundType

QuestionTextBox.Text = question

end)

tool.Equipped:Connect(function()

cardInfo.Parent = player.PlayerGui

end)

tool.Unequipped:Connect(function()

cardInfo.Parent = tool

end)

It’s giving me this error at this line and I have no clue of why it’s doing that…

If you can help out, that would be helpful and appreciated, thanks! :smile:

You should give the player as the first argument to FireClient.

I tried that, then it created another error, give me one second I’ll try it again.

And which script are you referring to?

I’m referring to the server script.

1 Like

Try creating another empty value / argument in the server script and fire only 2 in the client also I suggest printing your values so you could know what your argument is and to confirm It’s the right one.

OnClientEvent doesn’t pass player as a parameter since it’s the client, it already can access player

1 Like