Text Setting Not Working

I’m trying to set a TextLabel’s text, but it’s giving me this error:
Players.RipPBB_TUD.PlayerGui.LocalScript:74: attempt to index string with 'Text'

Code Part 1:

local function setText(nametxt, text1, text2, text3, text4)
	print("set")
	name.Text = nametxt
	txt1.Text = text1
	txt2.Text = text2
	txt3.Text = text3
	txt4.Text = text4
end

Code Part 2:

setText(
		"example", 
		"argument #2", 
		"example 3",
		"",
		"",
		""
	)

Thanks!

Name.Text? Shouldn’t it be:

name = nametext

And the nametext’s variable should be:

local nametext = "fard"

I might’ve misunderstood this. Is ‘Name’ a variable or the name of a instance?

1 Like

Could you share where you define name, txt1, etc.?

Uhh… give me a second. I think my issue is that I’m using the variable “name” which is a property of a TextLabel.

Could you show your explorer and the whole script?

I’ve actually solved it, the problem was that I was using the variable ‘name’.

1 Like