"and" is not working?

Hi, I am coding this simple validation thing, The values come up as 1 and 2 however it does not print “hi”. Any ideas why?

game.ReplicatedStorage.Answer.OnServerEvent:Connect(function(plr,questions,answers)
	local question = tonumber(questions)
	local answer = tonumber(answers)
	print(question .. "|" .. answer)
	if question == "1" and answer == "2" then
		print("hi")
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		print("hi")
	elseif question == "2" and answer == "1" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "3" and answer == "1" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "4" and answer == "2" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "5" and answer == "3" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "6" and answer == "4" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "7" and answer == "33" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "8" and answer == "1" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
		elseif question == "9" and answer == "1" then
		script.Parent.Questions:WaitForChild("Q" .. question).Value = true
	end
end)

You are comparing a string to a number.

1 Like

Sorry had no sleep tonight I just saw that :stuck_out_tongue: