Need help with TextBox

I made a script that kind generates a tiled map, depending on amount of xRows and zRows. The script is powered by GuiButton, and the xRows and zRows are obtained from TextBoxes in which I want player to input their values. However, when I try to change the value and activate the script, it does not get new text, but rather old one, that was set manually through TextBox properties. What am I doing wrong? Does the text require some sort of “Updating”?

Here is the script:

script.Parent.MouseButton1Click:Connect(function()
	local xRows = tonumber(script.Parent.Parent.IndicatorX.Text)
	local zRows = tonumber(script.Parent.Parent.IndicatorZ.Text)
	
	print(xRows, zRows)

local function GenerateMap(X, Z)
	for Xcount = 1, X, 1 do
		wait(0.1)
		for Zcount = 1, Z, 1 do
			wait(0.1)
			local node = game.ReplicatedStorage.Nodes.Node:Clone()
			node.Parent = workspace
			node.Position = Vector3.new(8 + (8 * (Xcount - 1)), 0.5, -8 - (8 * (Zcount - 1)))
		end
	end
end

if xRows ~= nil  and zRows ~= nil then
	GenerateMap(xRows, zRows)
else
	script.Parent.Parent.Active = false
	script.Parent.Parent.Enabled = false
	script.Parent.Parent.ZOffset = 0
	
	script.Parent.Parent.Parent.Error.Active = true
	script.Parent.Parent.Parent.Error.Enabled = true
	script.Parent.Parent.Parent.Error.ZOffset = 1
end
end)