Attempted to index Boolean with 'Text'

Hello, I would like some help…

I am trying to make a Surface GUI which shows a players name if you run a command such as: “!pass UserName”. I have wrote the code, however it errors and doesn’t work. The ONLY error message is shows is: “Attempted to index Boolean with ‘Text’.” This is the code it errors on, the LAST line is the line it says it errors on, the last line is:

			local Clone = Template:Clone().Parent == Frame
			Clone.Text = NameOfVictim

I do not understand why it errors, however it errors when I say “Clone.Text = NameOfVictim” NameOfVictim is just a string variable I created which is the name of the player we are running the command on.

That’s because the clone variable is a boolean. You’re checking if the parent of the clone is frame. The clone variable is always false since the parent is nil.

You’re using == which is the is equal to operator. Furthermore, you cant inline set parent and return the instance as far as I know

local x = something:Clone()
x.Parent = whatever
x.Text = youGetTheidea
2 Likes

I have removed the code to say:

local Clone = something:Clone()
Clone.Text = NameOfVictim

I have used a GUI list and even tested the list. However, somehow it doesn’t show up?

local Clone = Template:Clone()
Clone.Text = NameOfVictim
Clone.Parent = Frame

In your Clone variable your trying to check if the copy is parented to the frame, which might be the reason why your code is erroring.

These are my variable:

		local SplitMessage = Message:split(" ")
			local NameOfVictim = SplitMessage[2]
			local victim = game.Players:FindFirstChild(NameOfVictim)
			local Reason = Message:split(NameOfVictim)[2]

However, when I run the command it seems to not show the new screen gui clone. EVEN when I have a uiList

try this

local Clone = Template:Clone()
Clone.Parent = Frame
Clone.Text = NameOfVictim

ill try make something else if it won’t work

Thank you;

oh well no problem man just logic.