Party Service [v2.1] - create a party system more easily

When I use StartParty Function and then teleport another place, there is an error seems it cannot get the data from before place.


I Set Data when touch part and then :StatParty. And using script to receive the data in teleport Place like below.

partyService:SetPartyServerEmulator()


partyService.ServerStarted:Connect(function(data, partyInfo)
	-- print("IN")
	for _, player in ipairs(partyInfo.Players) do
		--print(player)
		local configFolder = player:WaitForChild("Configs")
		configFolder.PlayTime.Value = data.PartyRecord
	end
end)

1 Like

oh my mistake looks like the module is not putting players on the right table
Old Module Code:

table.insert(PartyInfoToSave, v.UserId) 

New Module Code:

table.insert(PartyInfoToSave.Players, v.UserId)

im trully sorry
anyway, to fix this issue you should download the new version of the module here. or if you are using require(9771730581) this change should already be available automatically

I also suggest that you modify your code a little to something like:

partyService:SetPartyServerEmulator()


partyService.ServerStarted:Connect(function(data, partyInfo)
	-- print("IN")
	repeat wait(1) until #game.Players:GetChildren() >= #partyInfo.Players -- wait until all the players are in the server
	for _, playerId in ipairs(partyInfo.Players) do
		--print(playerId)
		local configFolder = player:WaitForChild("Configs")
		configFolder.PlayTime.Value = data.PartyRecord[playerId]
	end
end)
1 Like

Oh, Appreciate for your help and really fast update !!

Oh I have a sudden question which is relative or not.
When I teleport place to place then there is an error in client side.
image
This keep shows up when I teleport between places.

I don’t know if it’s a problem in the module, but I’ll investigate

I don’t think this problem is belong to this modules. But thank you for investigate it.

1 Like

I would like to let you know that I have now made documentation for the module. No more trying to understand my bad code to know how a function works

1 Like

Can this system be used to implement a Clans kind of feature like in Clash of Clans?

how do i use it? also you should seriously make documentation for this module

there is some example codes in the post

and here is the documentation:

Module will not load.

2 Likes

Could you make a uncopylocked place with this set up so we could test it and debug our code?

3 Likes

don’t worry, I’m already investigating this issue

1 Like

So theres the function to send a party back to the lobby, but how does one get that party data in the first place?

Picture this. You have a private lobby, but connect to a public server. There are a lot more people than yourselves. Once the game has ended you want to go back to the lobby. So how do you determine who was in the correct parties to send back?

1 Like

image

Question: Would I have to add a debounce to the start party button (Teleports party) to prevent players from spamming it or not? And how + when do I use GetCurrentPartyInfo()?

(Im trying to get the party Id)

I don’t think so, since roblox itself can already take care of this when it teleports players

if you want to get the id of a party just use PartyTable.Id

Thanks, Ive started to try and make a party system using your module and I was wondering if you could read through my code and check if I’ve done everything right and if you have any suggestions for me to change.

Local script:

PartiesCreationPage.PartyGenerateButton.Activated:Connect(function()
	UISoundsFolder.Click:Play()
	if Chapter ~= nil then
		PartyEvent:FireServer("Create", Chapter, MaxPlayers)
		PartiesCreationPage.Visible = false
		InPartyPage.Visible = true
	end
end)

InPartyPage.PartyStartButton.Activated:Connect(function()
	PartyEvent:FireServer("Start")
end)


PartyEvent.OnClientEvent:Connect(function(Owner, Chapter, MaxPlayers, cmd)
	if cmd == "DisplayPartyOnFrame" then
		local UserId = Players[Owner.Name].UserId
		local ProfileImage = game.Players:GetUserThumbnailAsync(UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)

		local PartyDisplayFrame = script.PartyDisplayFrame:Clone()
		PartyDisplayFrame.PartyName.Text = Owner.Name.."'s party"
		PartyDisplayFrame.PlayerNumber.Text = "1/"..MaxPlayers
		PartyDisplayFrame.Chapter.Text = "Chapter: 1"
		PartyDisplayFrame.ProfileIcon.Image = ProfileImage
		PartyDisplayFrame.Name = Owner.Name

		PartyDisplayFrame.Parent = PartiesPage.PartiesScrollingFrame
		
		PartyDisplayFrame.ClickDetector.Activated:Connect(function()
			print("clicked")
			PartiesPage.Visible = false
			InPartyPage.Visible = true
			PlayButton.Visible = false
			PartyEvent:FireServer("JoinParty",nil, MaxPlayers, Owner)
			print("fired")
		end)
	end
end)

Server script:

local PartyService = require(ReplicatedStorage.Modules.PartyService)

PartyEvent.OnServerEvent:Connect(function(player, cmd, Chapter, MaxPlayers, Owner)
	if cmd == "Create" and PartyService:GetPartyPlayerIsIn(player) == nil then	
		local PartyCreated = PartyService:Create(player, 13007182239, MaxPlayers)
		PartyEvent:FireAllClients(player, Chapter, MaxPlayers, "DisplayPartyOnFrame")

	elseif cmd == "Start" and PartyService:GetPartyPlayerIsIn(player) ~= nil and player.Name == Owner.Name then
		PartyService:StartParty(PartyService:GetPartyPlayerIsIn(player))
		
	elseif cmd == "JoinParty" and PartyService:GetPartyPlayerIsIn(player) == nil and MaxPlayers > 1 then
		local Party = PartyService:GetPartyPlayerIsIn(Owner)
		PartyService:AddPlayer(player, Party)
		print("added")
	end
end)

Im kinda getting an issue right now where this elseif, wont work (the print doesnt print)

elseif cmd == "JoinParty" and PartyService:GetPartyPlayerIsIn(player) == nil and MaxPlayers > 1 then
		local Party = PartyService:GetPartyPlayerIsIn(Owner)
		PartyService:AddPlayer(player, Party)
		print("added")

maybe just share a .rbxl file so we can just run it and debug it…

Any errors in the output window?