I need to learn a bit more about ModuleScripts, the Info Site’s description of them is enough detail, but I have specific questions about them.
Number one being, can a exploiter potentially “abuse” them? (I have checks in my ModuleScripts for (server > client) and (client > server) data, basically standing as a cache, and wondering if an exploiter could hijack data.)
Here’s an example of what I mean, I currently have a ModuleScript standing as a Cache.
I made it so it can carry data, for when changing data when players are in-game, and saving that data when players leave, or the game does a shutdown, etc. I have functions that can get and set, but I implemented checks so that clients cannot abuse the functionality of the ModuleScripts. The checks listed are:
-
Authorization from a script by getting the (
LocalPlayer
) and seeing if there’s data about them in the auth table, if they’re not there then it won’t do anything. -
Anti-Setting for both Cache Set Functionality, and Auth Set Functionality. Prevents clients from making changes.
-
Prevent client from getting access to entire table unless authorized (Redirecting to number 1).
-
If not authorized then potentially take action against said player for usage of “exploits”.
But for number 2, I have a thing where you can get data, but I don’t know if the client can make changes to the exact table too, thus making that useless.
Code example:
-- Majority of code taken out for privacy.
function m:get(player)
return cache[player]
end
function m:set(player,val)
if not players.LocalPlayer then
cache[player] = val
else
return("restricted")
end
end
function m:setauth(p,v)
if not players.LocalPlayer then
auth[p]=v
else
return("restricted")
end
end
However, Server Scripts have access to them, but I just don’t know if exploiters can abuse the ModuleScript by replacing LocalPlayer
to nil, thus making the checks useless.
It seems I forgot some stuff about Lua, but that’s because it’s been such a long time while working with Lua. Typical Programmer stuff I guess.
Questions, Suggestions, etc. Are accepted.