Open Source Party Module

Open Source Party Module (Server-Side)

This is a server-side PartyModule that lets you create and manage parties in your game.
It supports:

  • Creating / deleting parties (by Player or by PartyId)
  • Adding / removing players
  • Changing party settings (name, private/public, leader)
  • Player ready state (per-player boolean)
  • Events for everything (join/leave/name/privacy/leader/ready + party created/deleted)

Note: This module does not replicate to clients automatically. If you want UI updates, forward changes to clients using RemoteEvents/RemoteFunctions.

Requirements (inside the ModuleScript)

Make sure you have folder/object named Settings inside the module, with:

  • DefaultPlayerReadyState (BoolValue) — initial ready state when someone joins a party
  • DefaultPartyPrivateState (BoolValue) — default privacy when creating a party without passing a boolean

Events

Module events

PartyModule.PartyCreated:Connect(function(party, partyId)
	print("Party created:", partyId)
end)

PartyModule.PartyDeleted:Connect(function(party, partyId)
	print("Party deleted:", partyId)
end)

Party events (BindableEvents)

When you create a party, the returned party has these events:

party.JoinedEvent.Event:Connect(function(player) end)
party.LeftEvent.Event:Connect(function(player) end)

party.PartyNameChanged.Event:Connect(function(newName) end)
party.PrivateStateChanged.Event:Connect(function(newState) end)
party.PartyLeaderChanged.Event:Connect(function(newLeader) end)
party.ReadyStateOfPlayerChanged.Event:Connect(function(player, newReady) end)

How to use

1) Require the module

local PartyModule = require(path.to.PartyModule)

2) Create a party

local party, partyId = PartyModule:CreateParty(player, false, "My Party")
-- Private (bool) and PartyName (string) are optional (defaults from Settings)

3) Add / remove players

party.AddPlayer(otherPlayer)
party.RemovePlayer(otherPlayer)

4) Change party settings

party.ChangeName("New Party Name")
party.ChangePrivateState(true) -- private
party.ChangePartyLeader(otherPlayer)

5) Ready state

party.ChangeReadyStateOfPlayer(player, true)

6) Get party from player / id

local partyFromPlayer, id = PartyModule:GetPartyFromPlayer(player)
local partyFromId = PartyModule:GetPartyFromId(partyId)

7) Get players in a party (by Player OR PartyId)

local playerList = PartyModule:GetPlayersInParty(player)         -- by player
local playerList2 = PartyModule:GetPlayersInParty(nil, partyId)  -- by id

8) Delete a party (by PartyId OR Player)

PartyModule:DeleteParty(nil, partyId) -- delete by id
PartyModule:DeleteParty(player)       -- delete the party the player is in

Note: This module does not auto-delete empty parties. Call DeleteParty yourself when you want it removed.


Free to use

This module is open source — you can use it freely in any project (personal or commercial).
Credit is appreciated but not required.
PartyModule.rbxm (5.8 KB)

14 Likes

Cool module, I’ll definitely have to come back to this however this would better fit in Resources > Community Resources instead of tutorials

5 Likes

I was indecise on which one it would fit more, thanks for the opinion. :slight_smile:

1 Like

Can you add where there is a gui for the various things? also a .rbxl or open source place to edit?

Thanks

1 Like

That’s a good idea, i will for sure make something like that on the weekend, a bit busy right now, thanks for the idea!

1 Like

Hi, how was the weekend? any updates and a .rbxl ? thanks