My question was probably not clear so I'll give a brief explanation.
I have a variable called "ctc" this is a random number between 1 and 250
when ctc is 3 it changes a value to "angel", how would I do this for multiple numbers?
like if I wanted 3 or 4 or 5 or 6 to also be "angel"?
local ctc= math.random(1,250) local try = ReplicatedStorage.PlayerStats[id].Tries.Value if try > 0 then if ctc == 3 then event:FireServer() script.Value.Value ="Angel" --script.Parent.Continue.Visible = true elseif ctc == 2 then event:FireServer() script.Value.Value = "Demon" --script.Parent.Continue.Visible = true elseif ctc== 1 then event:FireServer() script.Value.Value = "Fallen-Angel" --script.Parent.Continue.Visible = true end elseif try <= 0 then script.Parent.Parent.Tries.Value = 0 script.Parent.TextButton.Text = "No tries left!" end end
You want to use the or
gate, which returns true
if one or more of the given parameters is true
. For example, if you want to return 'angel' if ctc
equals 3,4, or 5, then you would structure it like this:
local ctc = math.random(1,250) if ctc == 3 or ctc == 4 or ctc == 5 then return "angel" end
If you have a large group of numbers that ctc
could equal, such as anything between 1 and 100, it is easier to structure it like this:
local ctc = math.random(1,250) if ctc >= 1 or ctc <= 100 then return "angel" end
or like this
if ctc >= 3 and <=5
Use or i.e
if ctc == 3 or ctc == 4 or ctc == 5 then
Did it wrong before