--Note: This isn't my exact code, but represents exactly what I'm doing.
EventName.Event:connect(function(plr, cost, key)
local Module = require(plr.ModuleScript)
print(key) --Returns the key which is declared as: local key = "KeyName" in script firing the event.
print(Module.key) --Returns nil even though the exact variable inside the module script is already declared as: ModuleScript.KeyName = false, instead doesn't recognize it and sets it as nil.
if Module.key == false then --Doesn't find the key in the script even though it is already declared before this, so it will return: print("key is true or nil, hopefully not nil, should be true."), because it is nil as it didn't find it.
--do code like: key = true
else
return print("key is true or nil, hopefully not nil, should be true.")
end
end)
This really irritates me because this would make my code so much more simplisitic instead I'd have to write a lot code extra to cover up for it, is there a way to make it so it knows what key is and not assume it's nothing?

1 comment
No shortcuts.