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

How would i make this script have multiple answers? Ex: Taco bell, Tacobell

Asked by 8 years ago
door = script.Parent --this is the door 

function onChatted(msg, recipient, speaker) 

-- convert to all lower case 

local source = string.lower(speaker.Name) 
msg = string.lower(msg) 

if (msg == "") then 
door.CanCollide = false 
door.Transparency = 0.7 
wait(5) 
door.CanCollide = true 
door.Transparency = 0 
end 

end 

function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered) 


0
Multiple answers for what? theCJarmy7 1293 — 8y
0
I want it to accept 2 answers if the answer has a space, For example: Taco Bell, or TacoBell it would accept the answer and continue the script. iiEffects 25 — 8y

2 answers

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

You can combine two conditions using or.

For example,

text == "apple" or text == "banana"

will be true whenever either the left, or the right (or both) are true.

See the Scripting Glossary for more

Ad
Log in to vote
0
Answered by
RedCombee 585 Moderation Voter
8 years ago

By the way, since your question has already been answered, this is just a tip, and I am not looking to answer the question.

Using a function like a.b(a)is equal to saying a:b(). Therefore, it is unnecessary to use string.lower(speaker.Name) or msg = string.lower(msg)because it is the same as speaker.Name:lower() or msg = msg:lower(). Just a tip that you might appreciate since it saves you a few characters.

Answer this question