Textbox to SurfaceGui text error

Hello, Devforums!

I want to make it so when I type something into a GUI textbox, it transfers to a SurfaceGUI text.
I found a script and modified it a little, but I keep getting one error I don’t know how to fix.
It says:
“Unable to assign property Text. string expected, got Instance”
I tried contacting the scripter, but nothing so far.
I also tried googling, searching on the Devforums and youtube, etc.
Here are the scripts.
–Local script in the GUI textbox–

local MyRemoteEvent = game.ReplicatedStorage.MyRemoteEvent
local MyTextBox = script.Parent

MyTextBox:GetPropertyChangedSignal("Text"):Connect(function(txt)
	MyRemoteEvent:FireServer(txt)
end)

–Script in the ServerScriptService–

local MyRemoteEvent = game.ReplicatedStorage.MyRemoteEvent
local MySurfaceGuiTextLabel = game.Workspace.P2.Table2.Sign.SurfaceGui.SIGN

	MyRemoteEvent.OnServerEvent:Connect(function(TextThatWasSent)
		MySurfaceGuiTextLabel.Text = TextThatWasSent
	end)

If I need to show anything else, just tell me and I will.
Thank you in advance!

1 Like

First arg - player. Must be:

MyRemoteEvent.OnServerEvent:Connect(function(plr, TextThatWasSent)
	MySurfaceGuiTextLabel.Text = TextThatWasSent
end)

Docs: RemoteEvent | Documentation - Roblox Creator Hub

1 Like

Now it says:
Unable to assign property Text. string expected, got nil

GetPropertyChangedSignal does not pass value, try MyRemoteEvent:FireServer(MyTextBox.Text)

Well, I’m glad you managed to get rid of the errors, but now when I type some text into the box, it just doesn’t transfer. No errors or anything.

Wow, nevermind. I just realized I’m stupid. It works, but I deleted the entire script (except for the local defining) and pasted that in. I fixed it now though, thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.