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

Attempt to index string with 'Text'?

I tried to change a gui text in a script and I got this error: Attempt to index string with 'Text'

Script:

local gui = script.BillboardGui:Clone()
gui.Parent = workspace:WaitForChild(player.Name):WaitForChild("Head")

gui.Name.Text = player.DisplayName.." (@"..player.Name..")"

1 comment

0

gui:FindFirstChild("Name").Text or rename "Name" to something else

1 answer

✓ Accepted answer

The problem is that you're trying to find the property "Text" on a GUI (when in fact it should be found on a textlabel) or the fact that you put the textlabel name as "Name" which is a property of all Objects in roblox studio. Try naming it something else or use :WaitForChild() / :FindFirstChild()

local gui = script.BillboardGui:Clone()
local TextLabel = gui:WaitForChild("TextLabel") -- or whatever you named the text label
gui.Parent = workspace:WaitForChild(player.Name):WaitForChild("Head")
	 
TextLabel.Text = player.DisplayName.." (@"..player.Name..")"

This should work.

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