I don't understand what is wrong here?

I am trying to make a player advertisement system, and I am working on the UI

Here is my code:

local TxtBox = script.Parent.AssetIdTxtBox
local ConfirmButton = script.Parent.Confirm



local AssetId = nil

local function getId()
	AssetId = TxtBox.Text
end 

TxtBox.Text:GetPropertyChangedSignal('Value'):Connect(getId)

while wait(10) do
	print(AssetId)
end

“PlayerGui.ScreenGui.Bg.LocalScript:13: attempt to call a nil value”

1 Like

I don’t believe a TextBox's Text value has another value in it, you’ll have to check with this:

TxtBox:GetPropertyChangedSignal('Text'):Connect(getId)

I don’t know why you did this, you can delete the “=” and “nil”. I presume this is where the nil is coming from.

I believe you’re trying to call GetPropertyChangedSignal on Text, which is a property itself. Instead, call it on the textbox and replace Value with Text.

SUGGESTION: Just do:

local AssetId

There.

1 Like