local code = script.Parent.Parent.Code.Value
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Text == code then
script.Parent.Text = "Success"
else
script.Parent.Text = "Incorrect"
end
end)
No matter what happens, it still says incorrect.
as you can see, the code does appear in the value, but it still doesn’t work
You can only Assign the Variable to the Instance, not the Value itself for it to work.
Try this:
local code = script.Parent.Parent.Code -- Instance
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Text == code.Value then -- Value
script.Parent.Text = "Success"
else
script.Parent.Text = "Incorrect"
end
end)
I will try this, but in all other cases when I use values i always get the value of the value and it works for me - is it different in this case and why? Edit: I’m getting the same error
Actually, maybe try this?
I think since the Text is a string and not a number, thats the reason
local code = script.Parent.Parent.Code
script.Parent.MouseButton1Click:Connect(function()
if tonumber(script.Parent.Text) == code.Value then
script.Parent.Text = "Success"
else
script.Parent.Text = "Incorrect"
end
end)