Setting function variables using getfenv/setfenv

So i made this script which has a clojure, theFunction returns another function which prints a variable in theFunction

But i tried changing the variable using getfenv(returnedFunction).variable but it didn’t work, does anyone know why?

I tried both getfenv and setfenv but it still didnt work

local function theFunction()
	local variable = 3
	
	return function()
		print(variable)
	end
end
local returnedFunction = theFunction()
getfenv(returnedFunction).variable = 4
returnedFunction()