Alright so, I am making a simulation of life. I have a math.random of 1,100. Instead of picking the value when it should be, it just skips the if statement and goes straight to the next line of code. It just skips the math.random and just goes straight to the print line.
local generatedName = math.random(1,2) local name = script.Parent.Stats.LastName.Value wait(1) if generatedName == 1 then name = "Smith" end if generatedName == 2 then name = "Jones" end print('Done.')
Any idea will be helpful, thank you.
You are setting your name variable to the Value, which will be read only after you do that. Instead, you need to set name to LastName, then set the Value of LastName in your if statement.
local generatedName = math.random(1,2) local name = script.Parent.Stats.LastName wait(1) if generatedName == 1 then name.Value = "Smith" else name.Value = "Jones" end print('Done.', name.Value)