Any idea to get this thing work?

So i have a Server gui that works like party system. How it work is basically if you join then your name would be there and once its full the timer will runs and teleport all player stored in the Gui/Value. But i still have no idea how would i make this work? And what should i use Remote Event or Remote function?

2 Likes

You can make the button fire a remote event that fires to the server that the player that clicked it joined the lobby.

local script in the button

local plr = game.Players.LocalPlayer
local button = script.Parent
button.Activated:Connect(function()
	"put your event here":FireServer(plr)
end)

server script

"put your event here".OnServerEvent:Connect(function()
	if "Check if the lobby is full" then return end
		-- Add the player to the lobby
	end
end)
1 Like

i know that, i just have no idea what to do with the OnServerEvent

1 Like

create a table in a module script or in the server script then teleport the players in that table

server script

local "put lobby name ie. Duo1"tbl = {}

"put your event here".OnServerEvent:Connect(function()
	if "Check if the lobby is full" then return end
		table.insert("put lobby name ie. Duo1"tbl, plr)
	end
end)
1 Like

I think you would do most of the gui stuff in the client and fire it to the server to set the player value, then fire all clients so that every client will see the player’s name in the gui

3 Likes

where should i store the player value for each frame though?

2 Likes

in a table

2 Likes

so i would use dictionary to set the player name text?

1 Like

you could make a list of values named player1 - player20 and assign the player’s name referenced from the client to one of the values, depending on which server they joined.

2 Likes

well won’t that like lag the game or do something because its like creating 20+ string values

1 Like

well you’d just use the player name because their player value was stored

Then make a table (specifically a dictionary) and assign the values to the players through a for loop

i created this silly image in order to explain better visually

the script would check the space in the table and check their “filled” value or something and would skip a space if it were full

dev

1 Like

Hmm i can understand it now but i’m still not sure about the Player name value maybe i will try table?

Whenever a player clicks the join button to a lobby it will fire to the server and check if there is an available space in that specific lobby. If there is, through the dictionary, change the value that aligns with the lobby space to the player’s username, and then fire all clients to make the players name appear in the lobby

I’m guessing what will happen is Once the player click the join button the event will fire to the server. And in the server it will add the player name to the table.

precisely

rfyhguuhifedsuihghuitgehui