Hello, I was starting to learn how to script in my Roblox game and after fixing all the syntax errors I got onto trying to fix the Unknown global errors but cannot figure out how to fix them.
local ModuleScript = {} mt = getrawmetatable(game) make_writeable(mt) local old = mt.__namecall mt.__namecall = newcclosure(function (self,...) local args = {...}
^^^ Thats all the code that has caused this error.
Usually, the error leads to unknown variable names or function calls the script doesn't recognize. Take these examples:
variable typo
local food = 100 --full hunger!! if fod == 100 then --fod is not defined and so it leads to the W001 unknown global error print("not hungry.") end
function call typo
local function Eat() food += 15 end script.Parent.Activated:Connect(function() if food == 100 then return false elseif food > 100 then food = 100 return false elseif food < 100 then Et() --Et() isn't defined so it leads to the W001 unknown global error end end)
Make sure to look through your scripts for typos, but also incorrect function calls. In this case you've probably typed in a function that is incorrect.
Here is a Roblox Dev Hub page upon Metatables.
https://developer.roblox.com/en-us/articles/Metatables
Hope this helped!