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)
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)
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?
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()?
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")