More specifically, how can I generate a random number between 1 and 10 and then define the number as a string? For example
local Strength = (random number generated)
More specifically, how can I generate a random number between 1 and 10 and then define the number as a string? For example
local Strength = (random number generated)
To generate a random number, use math.random(1,10)
Also, any value (integer, Boolean. string) can be made into a string. Say the string variable is as follows:
local string = "The number we generated is " .. Strength .. "."
This is called concatenation. The two periods (dots) in between string segments are the concatenation operators. They output any value given and/or add it to the variable it's placed in. This string variable will be displayed as:
The number we generated is [number generated with the "math.random" function].
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
so to define strength, I would put: local Strength = math.random(1,10) ?
Yes. Strength is just the name that you gave your variable.