Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to end an if statment?

Asked by 4 years ago
Edited 4 years ago

I was making a script where it would choose a random number out of 2 but to do it I had to do elseif and I want the else if to end so I can do an extra line of script even if the second one is chosen my script is:]

local function onbuttonactivated()
`roblox = math.random(1,2)
if roblox == 1 then
print (ysy)
elseif roblox == 2 then
print (yly)
print ("k")`
button.Activated:Connect(onButtonActivated)

I want to print k even if it is one I tried skipping some lines but it didn't work

how do I do this?

0
sorry person with other answer turquoise_monkeyman 32 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

end:

local roblox = math.random(1, 2)
if roblox == 1 then
    -- do stuff exclusive to roblox == 1
elseif roblox == 2 then -- could just use `else`; it can only be 1 or 2
    -- do stuff exclusive to roblox == 2
end
-- do stuff outside of the if statement
0
thank you! turquoise_monkeyman 32 — 4y
Ad

Answer this question