so i am making a game where is a machine that gives you a math problem. it is randomly generating the numbers for the problem but for testing purposes i did that it only can generate zero. ok so the problem is that when a value in a gui is the answer to the math problem it should normally print “right” but that’s not the case! it prints “wrong” and i have no idea on how to fix this. (and the value in the gui is set.)
Script:
local firstNumber = math.random(0,0)
local lastNumber = math.random(0,0)
local Answer = (firstNumber + lastNumber)
print(Answer)
script.Parent.SurfaceGui.FirstNum.Text = firstNumber
script.Parent.SurfaceGui.LastNum.Text = lastNumber
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if plr.PlayerGui.Game.Content.NumBall.CurrentlyHolding.Value == Answer then
print("right")
script.Parent.ClickDetector:Destroy()
plr.PlayerGui.Main.Cursor.Image = "http://www.roblox.com/asset/?id=9761205525"
script.Parent.Transparency = 1
plr.PlayerGui.Game.Content.YTP.Visible = true
plr.PlayerGui.Game.Content.YTP.TotalNum.Text = plr.YTP.Value
plr.PlayerGui.Game.Content.YTP.Got.Text = script.Parent.Give.Value
plr.PlayerGui.Game.Content.YTP.Got:TweenPosition(UDim2.new(0,0,0.3,0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.3)
wait(0.3)
plr.YTP.Value += script.Parent.Give.Value
plr.PlayerGui.Game.Content.YTP.Got.Position = UDim2.new(0,0,1,0)
wait(0.5)
plr.PlayerGui.Game.Content.YTP.Visible = false
elseif plr.PlayerGui.Game.Content.NumBall.CurrentlyHolding.Value == "Notholding" then
print("not holding anything")
elseif plr.PlayerGui.Game.Content.NumBall.CurrentlyHolding.Value ~= Answer then
print("wrong")
end
end)