πŸ«‚Parties

An addon script for parties between players, used to handle the data and events between members.

Party Data

Party data is stored in a GlobalState which can be accessed from any script server or client. Each party is identified via a unique partyId. A player's current party id can be accessed via their state. If done locally, this can be done via LocalPlayer.state.party. This then can be used to access the party data via the following:

local partyId = LocalPlayer.state.party
local partyData = GlobalState["Party:" .. partyId]

print(partyData)

-- Output:
--{
--    members = { 1 = true, 2 = true }, --A list of sources that are apart of the party.
--    playerCount = 2, -- The amount of members in the party
--    maxPlayers = 4, -- Max allowed players in the party
--    type = "example", -- Type of the activity set in the creation
--    data = {} -- Data stored by the party
--}

If you'd like to access the same data via the server, you an use the state bags again.

local partyId = Player(source).state.party

createActivityParty

This can be used to create a shareable activity and subsequent party data. Storing information like the host, activity type, members, invites and shared data. Once the activity has been created, the creator or "Host" is given a party radial menu option to invite leave the party.

Below is an example from the sanitation job

inviteToParty

While this won't be used often due to the radial menu option, it can be handy to forcibly invite members

removePlayerFromParty

Forcibly remove a player from a party.

endActivityParty

End the party activity

setPartyData

Update data connected to the party's global state.

resetPartyData

This can only be called via exports

Reset a parties data back to data provided.

triggerPartyEvent

Triggers a client event for all players within the party and with supplied arguments

triggerPartyNotif

Sends a notification to all the party members

Reffer to TMC.Functions.SimpleNotify for argument options

This event does not support the duration argument.

Dev Commands

/fakeinvite

If you wish to test the invitation system, you can use this to force the invited status.

/testparty

If you'd like to force yourself into a test party - default activity name "A test activity".

Last updated