.ChildRemoved isn’t firing for some reason, .ChildAdded works just fine, and so does the function it connects to, I even tested manually placing items into the Parties folder, and it fired when I added, but not when I removed them. Its for a lobby system, please help I have no idea why it isn’t working
First of all, it is ChildRemoved and not ChildRemoving so you used the event correctly.
Add a print statement at the beginning of updatePartList to test if ChildRemoved event was fired. Your event should work so I think the problem is somewhere within updatePartyList function.
I didn’t use ChildRemoving? and I have got a print statement at the very beginning of the function, it fires every single time that a Child is Added, and not once when it is removed, the function works perfectly, It has to be something to do with the calling of it
this is the output from when I do it, the first “joining party” is when I join the party, the second “joining party” is when I leave the party, “updating party list” only fires on joining (when the folder is added) not on removal
@MikeartsRBLX@Arkston , having actually looked into my updatePartyList function, and not assuming its perfect I realised the problem,
function updatePartyList()
for i, child in pairs(script.Parent.Players.PlayersList:GetChildren()) do
if child:IsA("Frame") then
child:Destroy()
end
end
for i, party in pairs(game.ReplicatedStorage.Parties:GetChildren()) do
print("updating party list")
local partyName = party.Name
local playerLimit = party:WaitForChild("PlayerLimit").Value
local playerCount = #party.Players:GetChildren()
local template = script.PartyTemplate:Clone()
template.PartyName.Text = partyName
template.PlayerCount.Text = playerCount .. "/" .. playerLimit
party.Players.ChildAdded:Connect(function()
template.PlayerCount.Text = #party.Players:GetChildren() .. "/" .. playerLimit
end)
party.Players.ChildRemoved:Connect(function()
template.PlayerCount.Text = #party.Players:GetChildren() .. "/" .. playerLimit
end)
template.Parent = publicServersList
publicServersList.CanvasSize = UDim2.new(0, 0, 0, publicServersList.UIListLayout.AbsoluteContentSize.Y)
template.Join.JoinButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.PartySystemRE:FireServer("joinParty", partyName)
end)
end
end
I forgot that it was running on a loop depending on how many children there are in the Parties Folder, and that given my party was the only one, when it is deleted the loop doesn’t run