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

How do I fix this TextBox to SurfaceGui problem?

I'm trying to make a textbox that when a button is clicked, a textlabel withing StarterGui will become the same as the text in the textbox. I have fired a remote event through a localscript within the textbutton. The script in ServerScriptService is this:

.game.ReplicatedStorage.InfoInput.OnServerEvent:Connect(function(player)
	game.Workspace.Board.SurfaceGui.Username.Text = game.StarterGui.ScreenGui.Frame.Username.Text
end)

1 comment

0

The weird line arrangement in the code isn't in the actual script, it's just how this website arranges it, I guess it's just a bit long.

1 answer

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local InfoInput = ReplicatedStorage:WaitForChild("InfoInput")

local GuiToSet = workspace.Board.SurfaceGui.Username

local function SetText(Player)
	local PlayerGui = Player:WaitForChild("PlayerGui")
	local Username = PlayerGui:FindFirstChild("Username", true)
	if (Username) then
		GuiToSet.Text = Username.Text
	end
end

InfoInput.OnServerEvent:Connect(SetText)

if this helps, don't forget to accept this answer!

1 comment

0

Thanks!

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