How would i make a table that is changeable by the server and viewable by the client?

Is there a way i could make a table that is changeable by the server and viewable by the client?
What im trying to do is make a networking system which hides the names of the remotes and stores the original remote name inside that table. Then the client would access it with ease and retrieve the remote.

Sort of like this:

image

image

-- Client
local remotes = {
   ["Remote1"] = game.ReplicatedStorage.RemoteEvent1,
   ["Remote2"] = game.ReplicatedStorage.RemoteEvent2,
   ["Remote3"] = game.ReplicatedStorage.RemoteEvent3,
end
-- Server
wait(1)

for i, v in pairs(game.ReplicatedStorage:GetDescendants()) do
   if v:IsA("RemoteEvent") then
      v.Name = ""
   end
end
1 Like

This caught my eye but is there a better way to do this cause this is kind of hacky

Why are you trying to hide the names of your remotes? If it’s for security reasons, I wouldn’t bother. Exploits have access to all local variables so they will easily just use your table.

2 Likes

Well, that is very true, but i’ve thought about this and not every exploiter would know how to find that table, so its just a “security-layer”.

But do you have any suggestions on how i could protect them in a better way?

Yeah, there really isn’t any point to it. I get what you’re trying to do but a quick local script dump or using getconstants would defeat the purpose.

You’re better off just securing it on the server.

1 Like

Wouldn’t it be better than just having their names showed off? I’ve seen alot of games doing that method.

1 Like

Personally it’s up to you as long as it’s secured on the server.

1 Like

What do you mean by secured on the server? Do you mean sanity checks?

1 Like

Once one exploiter finds it, they will share that information with the public. Not all exploiters are coders, many just use scripts created by others.

The best way to protect against exploiting is to trust nothing that comes from the client. All of your anti-cheat code should be on the server. Check everything that comes from the client through a RemoteEvent and check to see if it was possible for a real client to have sent it.

2 Likes

That is true, but wouldn’t it be an add-on to that?

Yeah, once again it really doesn’t matter as long as you’re comfortable with it and you are practicing good techniques.

And for the fun of it, here’s an example of the dumping I would be talking about

-- Somewhere in an exploit script
local script = getsenv(...)
for _, v in ipairs(script) do
     print(v)
end

Explanation:
Every chunk in lua is bounded by a environment, and by getting the environment of the script that we want, we can essentially “dump” whatever constants we desire.

Theoretically this code should work but I dont care enough to test.

1 Like

Do you have an idea on how i could pass that remote info table from server to client?