There's a lot of reasons why this doesn't work, you seem to misunderstand the meaning of variables.
References
When you say something like foo(hi), that gives the function foo the value of hi at the time of this call . For this, that would be either true or false.
If I later change hi, that doesn't affect foo -- the value was already decide a while ago.
Timing
The Check function only gets run once -- right when you call it. That's before you set hi. So modifying hi afterwards doesn't accomplish anything anyway.
How to write this right
There's no reason for a Script to try to give information to the ModuleScript -- the ModuleScript is perfectly capable of asking RunService itself.
Storing state in modules
If you do want to send information to a modulescript, you have to explicitly store it somewhere.
Here's a simple counter module. Calling module.set(n) will set the counter to n, and callign module.count() will print the count and tick up once:
module = {}
number = 0
function module.set(n)
number = n
end
function module.count()
print(number)
number = number + 1
end
return module
If you really want to engineer things well, you should avoid global variables (count). Global variables will often come to bite you later.
Instead, variables should always belong to an object -- that way, you can easily have more than one counter at a time:
module = {}
local function set(self, n)
self.number = n
end
local function count(self)
print(self.number)
self.number = self.number + 1
end
function module.new(n)
return {
number = n,
set = set,
count = count,
}
end
return module