{"id":27121288,"url":"https://github.com/ls9512/roblox_clientserverframe","last_synced_at":"2025-07-03T13:06:25.181Z","repository":{"id":286544608,"uuid":"961723504","full_name":"ls9512/Roblox_ClientServerFrame","owner":"ls9512","description":"This is a general-purpose network communication framework for Roblox game development, designed to simplify the use of RemoteEvents.","archived":false,"fork":false,"pushed_at":"2025-04-07T04:16:22.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T04:02:23.211Z","etag":null,"topics":["client-server","message","mulitplayer","network","remoteevent","roblox","roblox-lua","robloxplugin","robloxstudio"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ls9512.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-07T04:11:04.000Z","updated_at":"2025-04-07T05:03:02.000Z","dependencies_parsed_at":"2025-04-07T05:33:49.992Z","dependency_job_id":null,"html_url":"https://github.com/ls9512/Roblox_ClientServerFrame","commit_stats":null,"previous_names":["ls9512/roblox_clientserverframe"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ls9512/Roblox_ClientServerFrame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls9512%2FRoblox_ClientServerFrame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls9512%2FRoblox_ClientServerFrame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls9512%2FRoblox_ClientServerFrame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls9512%2FRoblox_ClientServerFrame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ls9512","download_url":"https://codeload.github.com/ls9512/Roblox_ClientServerFrame/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls9512%2FRoblox_ClientServerFrame/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263331769,"owners_count":23450155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-server","message","mulitplayer","network","remoteevent","roblox","roblox-lua","robloxplugin","robloxstudio"],"created_at":"2025-04-07T10:57:57.915Z","updated_at":"2025-07-03T13:06:25.159Z","avatar_url":"https://github.com/ls9512.png","language":"Lua","readme":"[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu)\n[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE)\n\n# Roblox_ClientServerFrame\nThis is a framework designed to encapsulate Roblox RemoteEvent functionality, providing a universal network communication interface to significantly simplify and standardize the network communication development process. It helps avoid the frequent creation and management of numerous RemoteEvents. Through a few automatically maintained events and a standardized communication message structure, it automatically handles request parsing, invocation, and response processing. This framework has already been applied in several real-world projects.\n\n# File\n## NetClient.lua\nThe core client script. It initializes client-side network communication and is responsible for sending requests to the server and receiving returned results. All such communications must be done via this script.\n## NetUtil.lua\nA utility class that handles general-purpose tasks such as event creation and error handling. Usually, it does not need to be manually invoked.\n## NetServer.lua\nThe core server script. It receives requests from clients and dispatches them to specific modules, processes the return results, and sends them back to the clients. It can also be used to actively send messages to specific clients or all players.\n\n# How to use\n## Usage Guidelines\nClient-to-server request code must be called through LocalScript, while server-side logic must be invoked through Script. There are two types of network requests: Request and Broadcast. The routing structure follows a Module / Action / Param pattern, where functionality is grouped by Module, each containing multiple Actions (request handlers), each of which can accept custom Params. More details and examples are provided below.\n\n## Request\nSent proactively from the client to the server. The server parses the request route and executes specific logic or queries data, optionally returning a result.\nIn server scripts under ServerStorage/Net/Request, create scripts named after the module, for example, Game.lua for managing core game logic — in this case, the module name is Game. Inside Game.lua, define request-handling functions where the function name serves as the Action name, and the parameters must be in the form (player, param) — representing the request sender and parameters. Both parameters and return values are optional, depending on the specific use case.\n\n## Broadcast\nProactively sent from the server to the client when needed. The client parses and executes the corresponding logic.\nThese should be placed in ReplicatedStorage/Net/Broadcast, and named consistently with the corresponding Request modules.\n\n# Sample\n## Client Script\n\n### Init Client\n```lua\n-- Call NetClient:Init in StarterPlayer/StarterPlayerScripts\nlocal NetClient = require(game.ReplicatedStorage.Script.Net.NetClient)\nNetClient:Init()\n```\n\n### Request without return value async\n```lua\nfunction NetClientDemo:RequestTest1()\n\tNetClient:Request(\"ServerRequestModuleDemo\", \"OnRequest\", { Message = \"Send message to server\"})\nend\n```\n\n### Request with return value async\n```lua\nfunction NetClientDemo:RequestTest2()\n\tNetClient:Request(\"ServerRequestModuleDemo\", \"OnRequest\", { Message = \"Send message to server\"}, function(result)\n\t\tprint(result)\n\tend)\nend\n```\n### Request without param and return value async\n```lua\nfunction NetClientDemo:RequestTest3()\n\tNetClient:Request(\"ServerRequestModuleDemo\", \"OnRequest\")\nend\n```\n\n### Request and wait for return value\n```lua\nfunction NetClientDemo:RequestTest4()\n\tlocal result = NetClient:RequestWait(\"ServerRequestModuleDemo\", \"OnRequest\")\n\tprint(result)\nend\n```\n\n### Request many action in once\n```lua\nfunction NetClientDemo:RequestTest5()\n\tNetClient:RequestQueue({\n\t\t{\n\t\t\tModule = \"ServerRequestModuleDemo\",\n\t\t\tAction = \"OnRequest\", \n\t\t\tParam = { \n\t\t\t\tMessage = \"Message1\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tModule = \"ServerRequestModuleDemo\",\n\t\t\tAction = \"OnRequest\", \n\t\t\tParam = { \n\t\t\t\tMessage = \"Message2\"\n\t\t\t}\n\t\t}\n\t}, function(result)\n\t\tlocal result1 = result[1]\n\t\tprint(result1)\n\t\t\n\t\tlocal result2 = result[2]\n\t\tprint(result2)\n\tend)\nend\n```\n\n### Client Broadcast Process\n```lua\nlocal ClientBroadcastModuleDemo = {}\n\nfunction ClientBroadcastModuleDemo:OnBroadcast(player, param)\n\tlocal message = param.Message\n\tprint(message)\nend\n\nreturn ClientBroadcastModuleDemo\n```\n\n## Server Script\n### Init Server\n```lua\n-- Call NetServer:Init in ServerStorage\nlocal NetServer = require(game.ServerStorage.Net.NetServer)\nNetServer:Init()\n```\n\n### Server Request Process\n```lua\nlocal ServerRequestModuleDemo = {}\n\nfunction ServerRequestModuleDemo:OnRequest(player, param)\n\tif param ~= nil then\n\t\tlocal message = param.Message\n\t\tprint(message)\n\telse\n\t\tprint(\"Request without message\")\n\tend\n\t\n\treturn true\nend\n\nreturn ServerRequestModuleDemo\n\n```\n\n### Boradcast to one player\n```lua\nfunction NetServerDemo:BroadcastTest1()\n\tlocal player = game.Players:GetPlayers()[1]\n\tNetServer:Broadcast(\"ClientBroadcastModuleDemo\", \"OnBroadcast\", { Message = \"Broadcast to client message\"})\nend\n```\n\n### Broadcast to all player\n```lua\nfunction NetServerDemo:BroadcastTest2()\n\tNetServer:BroadcastAll(\"ClientBroadcastModuleDemo\", \"OnBroadcast\", { Message = \"Broadcast to client message\"})\nend\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fls9512%2Froblox_clientserverframe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fls9512%2Froblox_clientserverframe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fls9512%2Froblox_clientserverframe/lists"}