How can I get a random number between 1 and 10, and add it to a string. for example
I get 7
'You caught a 7lb fish!'
another example:
You caught a 2lb fish!'
please help
Use math.random.
lbs=math.random(1,10)
A way to do this is using
local g = math.random(1,10)
this creates a random number between one, and ten.
To put this into a string, you would do string value.
local stringvalue = script.Parent.Pounds.Value -- Referencing the value. local f = tostring("You have caught a"..g.."lb. fish!") -- This combines g, our math.random, and the string. stringvalue = f -- Makes the value equal to the tostring function.
lbs = math.random(0, 10) if lbs > 5 then print("You got a big fish ! :)") else print("You got a little fish ! :(") end
or you can also do this:
lbs = math.random(0, 10) print("You caught a "..lbs.."lb".."fish !")