How to extract the value of the variable from the function? e.g. I want to get value from “levelUp” and input it in the new variable outside the function.
Simple… simply return it at the end of the function
local function push() tapCount = tapCount + 1 tapText.text = tapCount if tapCount == 5 then levelUp = levelUp + 1 levelValue.text = levelUp tapCount = 0 end return levelUp \<-- this is what you are missing end
Simple… simply return it at the end of the function
local function push() tapCount = tapCount + 1 tapText.text = tapCount if tapCount == 5 then levelUp = levelUp + 1 levelValue.text = levelUp tapCount = 0 end return levelUp \<-- this is what you are missing end