Functions that only work on the server in shared modules

I want the client to have access to the Data key in the script, so the client can display it, but I also want the sever code to be in the same module so I only need one per block.

local MyBlock = {
    Data = {
        Description = "...",
    },
}

-- Only runs on the server
function MyBlock.Create(...) end
function MyBlock.OnTick(...) end
function MyBlock.Save(...) end

return MyBlock

Even though those functions only work on the server, does it give the client information about how it works that it shouldn’t have?

Code that is put in scripts that the client can access will be visible to the client, even if server-only functions are stored inside them, and exploiters could potentially see what the code does.
However, I believe that it’s not viewable as plain text, as roblox compiles scripts into an intermediary form before it is run on a device. It is probably better to keep server code away from clients, as you don’t want to give exploiters any kind of understanding of the backend.

Hope this helps

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.