1 | |
2 | |
3 | |
4 | |
5 | local Protected_Instances = {} |
6 | |
7 | local ProtectHook; ProtectHook = hookmetamethod(game, "__namecall", function(self, ...) |
8 | if table.find(Protected_Instances, self) and not checkcaller() then |
9 | return nil |
10 | end |
11 | |
12 | return ProtectHook(self, ...) |
13 | end) |
14 | |
15 | local ClassNameHook; ClassNameHook = hookmetamethod(game, "__index", function(self, index) |
16 | if index == "ClassName" and table.find(Protected_Instances, self) and not checkcaller() then |
17 | return nil |
18 | end |
19 | |
20 | return ClassNameHook(self, index) |
21 | end) |
22 | |
23 | local InstanceHook; InstanceHook = hookfunction(Instance.new, function(...) |
24 | local Arguments = {...} |
25 | |
26 | if checkcaller() and Arguments[1] then |
27 | local CurrentInst = InstanceHook(...) |
28 | table.insert(Protected_Instances, CurrentInst) |
29 | return CurrentInst |
30 | end |
31 | |
32 | return InstanceHook(...) |
33 | end) |