Having issues with comparing 2 values in GUIs

  1. What do you want to achieve? Keep it simple and clear!
    I want my script to compare those two values and do something if they are equal to eachother

  2. What is the issue? Include screenshots / videos if possible!
    The script does work, but it does not compare, the ‘‘print(ans.Value)’’ and ‘‘print(input.Value)’’ does print their values, even if they are the same, yet it doesn’t work

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have shearched for a while but yet I found nothing on how to fix my issue

Here’s the code that im using

while wait(0.1) do
	local ans = script.Parent.Answer
	local inp = script.Parent.Input

	print(ans.Value)
	print(inp.Value)

	if ans.Value == inp.Value then --Issue here, if the values printed are the same, it still doesn't work
		script.Parent.CanConfirm.Value = true
	else
		script.Parent.CanConfirm.Value = false
	end
end

Would like some help, thanks!

Are they the same type of value, for example, a string containing “1” is different than a number containing 1. If not, you can make them the same by using tonumber() or tostring() (Depending on the info being shared)

1 Like

Ohhhh it was that! My Answer value was a StringValue and not a IntValue wich I used for the other one, thank you!

1 Like

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