script.Parent.Triggered:Connect(function () local function rng() return math.random(1, 10) end if rng() >= 3 then print ("Number:"..rng().." Success") else print ("Number:"..rng().." Fail") end end)
I was just messing around with having a part with a ProximityPrompt in it and a script which you see above. I'm trying to get the local function rng() to print to show exactly what number was produced in relation to it succeeding (by being 3 or over) or failing (being 2 or less). I realize that I can't call the local function to print the number because that'll just produce a whole new random number between 1 and 10 and have no relation to the if statement criteria.
So, my question is how would I go about printing the initial number from the local function rng() to show in relation to if the number succeeded or failed in the if statement? Any help is appreciated. Thank you!