What’s up DevForum? I got a quick question.
Can a single ModuleScript store multiple functions where some of its functions can only be used by the client and some of its functions can only be used by the server? And if this is the case, I have multiple questions:
- Is there a more efficient/more organized solution compared to this setup?
- Would exploiters be able to see the server-sided functions within the ModuleScript, given that the ModuleScript is placed inside ReplicatedStorage.
Here’s a snippet of what I’m trying to explain:
local Module = {}
local RunService = game:GetService("RunService")
if RunService:IsClient() then
function Module.FunctionForClientOnly()
return true
end
end
if RunService:IsServer() then
function Module.FunctionForServerOnly()
return true
end
end
return Module
Edit: For more context, I wanted to revamp my game. My game has abilities players can use when they’re fighting against boss raids. The Client-sided code creates the visuals, detects if any mobs are hit, loads the animations, and other client-related stuff to make the visuals appear as smooth as possible. The Server-sided code would be needed to deal with all of the logic, such as verifying which mobs were hit by the attack, damage logic, etc.