Is there anyway to detect changes to global functions or if its overridden?
For example, if I use PlayerID() and its supposed to return 123 but a cheater injects code into my anticheat to make it return 124 is there any way to detect that?
For example, look at the code below:
_G.PlayerId = function()
return 124
end
Also, if there is any other basic integrity functions I can add, please tell me 
Not sure right now, but there’s a way in Lua to get the address of the func? Like if you do:
print(_G.PlayerId)
It should print like a function addr, so may be you can get that to identify if is the original?
In short, no.
Longer answer is, it’s not needed to add such functionality since cheat injectors no longer inject into server scripts but rather use the cfx internal engine. It’s done this way because injecting into loaded scripts is simply easily detected by many anticheats so cheat creators went back on that feature.
But if you need to ensure that global function does not change during runtime simply use this structure:
_G.PlayerId = function() -- your function
return 123
end
local PlayerId = _G.PlayerId
_G.PlayerId = function() -- cheat function
return 124
end
print(PlayerId(), _G.PlayerId()) -- 123, 124
Using upvalues/local values rather than global values is both better in terms of Access optimization and Runtime safety.