Table not updating for all players (script with remote events)

Hello all,

I was making a player party system with tables and was trying to figure out how to add players to the table of a players party when they clicked a button. When I was trying to insert the player into the table it works for the client clicking the button but not the party leader. What am I doing wrong with my code?

This remote event is put into another OnServerEvent (function?) and then that is :FireServer(d?) on another client script.

local CreatePartyEvent = game.ReplicatedStorage.Events.CreatePartyEvent
local player = game.Players.LocalPlayer


CreatePartyEvent.OnClientEvent:Connect(function(PartyLeader)
	
	local PartyButton = game.ReplicatedStorage.ScreenAssets.PartyButton:Clone()
	local players = game.Players:GetChildren()
	
	local playerPartyFolder = Instance.new("Folder", workspace.Parties)
	local folderofNames = playerPartyFolder:GetChildren()
	
	table.insert(folderofNames, PartyLeader)
	
	playerPartyFolder.Name = (tostring(PartyLeader) .. "'s Party")
	
	
	
	PartyButton.Parent = player.PlayerGui.MainMenu.Menu.PartyFrame.ScrollingFrame
	

	
	
	PartyButton.MouseButton1Click:Connect(function()
		
		if not table.find(folderofNames, player) then
			table.insert(folderofNames, player)

		else
			print(folderofNames)
		end
		
	end)

	PartyButton.Name = tostring(PartyLeader)

	PartyButton.Text = (tostring(PartyLeader) .. "'s Party")

	
end)

Thank you,

Ultan

Just making sure, You’re creating the parties on both clients rather than just doing it on the server?

2 Likes

Honestly, I am a bit torn on which to do, I think I am creating seperate parties for each client. I honestly have no idea on how to make 1 party for the server.

You should definitely make them on the server and just use remotes to change the gui of the partymembers when needed. Such as a new partymember joining the party, prompting a player to join the party, or a partymember leaving the party/game.

1 Like