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

RemoteEvent change GUI text not working?

Ok, guys! I am trying to make an SCP game. I want to have the description change when the player clicks a button stating a role(Class-D, MTF, etc). Each button has a LocalScript. That script sends data to a RemoteEvent, which then sends the message to a Script that is supposed to change the text. But I keep getting an error! Please help me!

Hierarchy of GUI:

https://postimg.cc/nsD2jLY2

ServerScript:

local Title = script.Parent:FindFirstChild("TeamName")
local Desc = script.Parent:FindFirstChild("TeamDesc")
local Event = script.Parent.Parent:FindFirstChild("MakeTeam")
Event.OnServerEvent:Connect(function(title,desc)
	Title.Text = title
	Desc.Text = desc
end)

LocalScript:

script.Parent.MouseButton1Click:Connect(function()
	local Event = script.Parent.Parent.Parent.Parent:FindFirstChild("MakeTeam")
	Event:FireServer(script.Parent.Text,script.Parent:FindFirstChild("Desc").Value)
end)

The error I am getting:

19:48:41.078 - Players.TheLastHabanero.PlayerGui.ScreenGui.Desc.Script:5: bad argument #3 to 'Text' (string expected, got Object)

Thanks for any help!

1 answer

✓ Accepted answer

I'm not entirely sure, but in the server script on line 5, you have this:

Event.OnServerEvent:Connect(function(title,desc)

I believe you need to have 3 variables in the :Connect(function(). The 3rd variable, (Technically 1st) would be for the player, the following ones would be data transmitted through the remote event. (The title and desc)

Like I said though, I don't know for sure if this is it, but try it and tell me if it doesn't work.

2 comments

0

(Sorry, on line 4 you have that)

0

Yup it worked! Just added a random "par" variable to it! Thanks!

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