Lobby code is equal to the code i typed in, still saying its wrong

sending the code with a button on the client end, tracking what the code text is for the textbox, for some reason the code is the exact same and still comes back wrong

MODULE

queuelib.Lobbycode = {
	
}

function queuelib.CreateCard(plr, status, cardname, card)
	card.Parent = plr.PlayerGui["Queue System"].MainFrame.ScrollingFrame
	card.LobbyName.Text = cardname
	if status == 1 then
		card.Status.Text = "locked"
		local lobbycode = 0
		local randomnumber = math.random(1000,9999)
		lobbycode = randomnumber
		table.insert(queuelib.Lobbycode,lobbycode)
		print(queuelib.Lobbycode)
	elseif status == 0 then
		card.Status.Text = "unlocked"
	end
end


function queuelib.CheckCode(code)
	print(code)
	if table.find(queuelib.Lobbycode, code) then
		print("we did it")
	else
		print("wrong code")
	end
end

SERVER

CodeSend.OnServerEvent:Connect(function(plr,code)
	QueueModule.CheckCode(code)
end)

2 Likes

The array’s empty…

1 Like

no its not that, i insert a lobby code when a new lobby is created thats randomly generated with math, so its not empty

1 Like

Could you show that part of the code?

1 Like

updated for ya’ sorry my bad i forgot about that

1 Like

Are you sure you are sending the code as a number and not a string?

2 Likes

ah, its being sent through a textbox from the client end, so its probably being sent as a string, but it prints out as a number oddly enough, thats probably my issue, let me test that

1 Like

While printing Roblox converts numbers to strings so ye… Also, its better to send the string through the RE and then convert it to number in the server side because numbers have bigger byte overheads

1 Like

ah yep, that would be my problem, thank you LOL i was like it looks the exact same why is it being weird with me LOL, we got it though, ill mark u as the solution, tyvm

2 Likes

Np

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.