So, I am making a code system where players can enter a code and they get something from redeeming the code. Although for me it is not displaying when a code is invalid but when you type a valid code it displays it’s valid. Also, this is not going to be the full script so I know there are no checks to stop the player from redeeming the code again. If someone could help me fix this that would be good.
local plr = game.Players.LocalPlayer
local CodeInput = script.Parent.Parent:WaitForChild("CodeInput")
local ValidCode = script.Parent.Parent:WaitForChild("ValidCode")
local InvalidCode = script.Parent.Parent:WaitForChild("InvalidCode")
local Codes = {"Test","Test2"}
script.Parent.MouseButton1Click:Connect(function()
if CodeInput.Text == Codes[1] or Codes[2] then
if CodeInput.Text == Codes[1] then
print("Code1 is valid!")
InvalidCode.Visible = false
ValidCode.Visible = true
elseif CodeInput.Text == Codes[2] then
print("Code2 is valid!")
InvalidCode.Visible = false
ValidCode.Visible = true
end
else
print("Code is invalid!")
ValidCode.Visible = false
InvalidCode.Visible = true
end
end)