TextLabel table problem

Hello, I’ve made a table that consists of 5 text labels and for some reason when I try to loop through the table, it doesn’t work and the output doesn’t print any error…
Here is the code:

local reqnum = 0
local labels = {frame.PatientName1,frame.PatientName2,frame.PatientName3,frame.PatientName4,frame.PatientName5}

ReplicatedStorage.HospitalSystem.PatientEvent.OnServerEvent:Connect(function(plr,regiment)
	reqnum = reqnum + 1 -- Number of patient request
	
	for i,v in ipairs(labels) do
		if reqnum == v.RequestNum then
			v.Visible = true
			v.Text = plr.Name.."//"..regiment
		elseif reqnum > 5 then 
		print("Too many requests")	
		 end
	end
	
end)

“RequestNum” is a number value inside each one of the 5 text labels.

Try frame.PatientName1.Name or .Text
Your saving the instance here instead of the name.
Also I don’t think you can put instances in tables.

You need to do:

if reqnum == v.RequestNum.Value then

For some reason, both won’t work

Instances are technically tables, and they can very much be stored in tables.

1 Like