LocalScript Not Working After 3rd Player Joins Queue

Local Script

local RefreshText = game.ReplicatedStorage.RefreshText
local player = game.Players.LocalPlayer
local qf = game.ReplicatedStorage.QueueFolder

	local qf1 = game:GetService("Players"):GetPlayerByUserId(qf.Player1.Value)
	local qf2 = game:GetService("Players"):GetPlayerByUserId(qf.Player2.Value)
	local qf3 = game:GetService("Players"):GetPlayerByUserId(qf.Player3.Value)
	local qf4 = game:GetService("Players"):GetPlayerByUserId(qf.Player4.Value)
	local qf5 = game:GetService("Players"):GetPlayerByUserId(qf.Player5.Value)
	local qf6 = game:GetService("Players"):GetPlayerByUserId(qf.Player6.Value)
	local qf7 = game:GetService("Players"):GetPlayerByUserId(qf.Player7.Value)
	if player == qf1 or qf2 or qf3 or qf4 or qf5 or qf6 or qf7 then
		local Equation = 7 - game.ReplicatedStorage.QueueFolder.QueueCount.Value
		player.PlayerGui.WelcomeScreen.Frame2.TextButton.Text = Equation.." more people are needed to start"

Hello! So, the title says most of my problem. What I’m trying to do here, is to change/refresh the player’s gui, but only if they’re in the queue. To do this, I made a folder with number values and changed the values via server script to their UserId when they pressed join queue. Just to put more emphasis, I only want it to change the player’s gui if they’re in the queue.

It works perfectly fine when the second player joins. However, when a third player joins, the third player’s gui changes even though their ID isn’t in the queue/isn’t in any of the number values. Nothing appears in output.

Also, I know some parts of my script may be inefficient so if you have a better method please let me know!

If any further information is needed please let me know.

1 Like

Everything looks fine on the client. It could have something to do on the server-side

1 Like
local RefreshQueue = game.ReplicatedStorage:WaitForChild('RefreshQueue')
local QueueFolder = game.ReplicatedStorage:WaitForChild('QueueFolder')
local QueueCount = QueueFolder:WaitForChild('QueueCount')
local RefreshQueueText = game.ReplicatedStorage.RefreshText

	QueueCount.Value = math.clamp(QueueCount.Value + 1, 0, 8)
	local UserId = clicker.UserId
	if QueueCount.Value == 1 then
		QueueFolder.Player1.Value = UserId
	elseif QueueCount.Value == 2 then
		QueueFolder.Player2.Value = UserId
	elseif QueueCount.Value == 3 then
		QueueFolder.Player3.Value = UserId
	elseif QueueCount.Value == 4 then
		QueueFolder.Player4.Value = UserId
	elseif QueueCount.Value == 5 then
		QueueFolder.Player5.Value = UserId
	elseif QueueCount.Value == 6 then
		QueueFolder.Player6.Value = UserId
	elseif QueueCount.Value == 7 then
		QueueFolder.Player7.Value = UserId

Here is my server script, which changes the queue values & fires all clients! Not sure if it has anything to do with it though.

Ohh I’m sorry one mistake I see is you put player == value or value or value when you should’ve said player == value or player == value, etc

1 Like

OH! I’ll try fixing that right now and test if it works with 3 people.

IT WORKED! Thank you so much!! :heart: Marked as a solution!

1 Like