Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to end an if statment?

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?

1 comment

0

sorry person with other answer

1 answer

✓ Accepted answer

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

1 comment

0

thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.