I'm making a license plate generator for a car so i did this
script.Parent.Text = math.random(0,9)math.random(0,9)math.random(0,9)math.random(0,9)
but it's only set 1 value but i needed 4
Problem
math.random() does return a randomly generated value and all 4 of your math.random() functions are returning a value. Only 1 is being used since you need to concatenate the numbers together.
Concatenating Strings
Concatenation is essentially adding/joining things together. With Lua, you concatenate strings with the ..
operator.
An example:
local x = "This is a " local y = "string!" print(x.." "..y) -- this prints "This is a string!"
In your case, you need to first, convert the randomly generated numbers into strings. This can be done with the tostring()
method. Secondly, you need to concatenate or join the randomly generated numbers together, to form one full string.
Here is the final code:
script.Parent.Text = tostring(math.random(0, 9))..tostring(math.random(0, 9))..tostring(math.random(0, 9))..tostring(math.random(0, 9))
Feel free to ask any questions, hope this helped!