Changing Table Value

I’ve looked in countless places but can’t seem to find it. How would I go about changing a Table Value allowing it to save the next time I run the function?

Example:
This code below only prints False when the function has been fired.

local function testFunc()
	local testTable = {
		boolValue = true
	}
	
	if testTable.boolValue == true then
		testTable.boolValue = false
		print(testTable.boolValue)
	else
		testTable.boolValue = true
		print(testTable.boolValue)
	end
end



part.ClickDetector.MouseClick:Connect(function()
	testFunc()
end)

Thanks in advance!

Take out the table.

local testTable = {
	boolValue = true
}

part.ClickDetector.MouseClick:Connect(function()
	testTable.boolValue = not testTable.boolValue
    print(testTable.boolValue)
end)

you can also do this:

part.ClickDetector.MouseClick:Connect(testFunc)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.