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

How do I put multiple "or" in my script?

I'm trying to make a bomb that has multiple time settings, but I'm really confused with all of these or things (I don't know the correct term) can someone help me out with this?

local sound = script.Parent.Parent.Parent.Explosion
local button = script.Parent

if script.Parent.Parent.Arm.Text == "ARMED"
	and
script.Parent.Parent.Remainder.Text == "01:00"
then
wait(60)
or
script.Parent.Parent.Remainder.Text == "00:30"
then
wait(30)
or
script.Parent.Parent.Remainder.Text == "00:10"
then
wait(10)

local ex = Instance.new("Explosion")
ex.BlastPressure = 999e999
ex.BlastRadius = 150

I'm also a bit of a noob, so please go easy on me!

4 comments

0

I don't understand what your question is

0

I'm trying to make a bomb where you can change the time before the explosion (it's on a surface GUI by the way) but I don't know how to do it very well and all I could come up with was using "or"

0

replace or with elsif? Thats what Im geussing

0

Instead of "or" use "elseif".

1 answer

You seem to be using 'or' like an 'elseif'

I think what you are trying to do is:

-- look to see if text says "ARMED"
if script.Parent.Parent.Arm.Text = "ARMED" then 
	-- if it does say ARMED then we check the time on the bomb
	if script.Parent.Parent.Remainder.Text == "01:00" then
		wait(60)
	elseif script.Parent.Parent.Remainder.Text == "00:30" then
		wait(30)
	elseif script.Parent.Parent.Remainder.Text == "00:10" then
		wait(10)
	end
end

see how you use elseif instead of or?

'or' is used like so

if value = 5 or value = 10 then
	--do stuff
end

use 'or' when you want a conditional to look for multiple conditions to be satisfied, BUT you only need 1 to be satisfied.

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