I am just messing around with random numbers and was trying to make a system that would update every time a higher number is generated.
local rtext = script.Parent.Parent.Random
local htext = script.Parent
htext.Text = 0
while true do
wait(.01)
if rtext.Text > htext.Text then
htext = rtext
end
end
When I run this the console says I am trying to compare nil values, is there an easy way to make the text from a GUI into an integer value?

1 comment
on line 8, you may want to change them to “if tonumber(rtext.Name) > tonumber(htext.Name) then”. tonumber() can change any string variable or instance into a readable format for the computer, so it’s best to use this function when reading numbers off of a string.