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

shortcut type in text not working properly, help?

Asked by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

if you type in "h", "hi" it will print noob, if you type in "l" "lo" or "lol", it will print idiot, it doesn't work; please help

Here's the script:

script.Parent.BackGround3.Enter.MouseButton1Click:connect( function()
local Order1 = script.Parent.BackGround3.Order1Handler
local noob = {"h", "hi"}
local idiot = {"l", "lo", "lol"}

    if Order1.Text == noob[1 or 2] then
    print("noob")
    elseif Order1.Text == idiot[1 or 2 or 3] then
        print("idiot")

end
end)

2 answers

Log in to vote
1
Answered by 4 years ago

Use if (statement) == (table)[1] or (statement) == (table)[2] then; you can continue it since [1 or 2 or 3] is NOT correct, try this

script.Parent.BackGround3.Enter.MouseButton1Click:connect( function()
local Order1 = script.Parent.BackGround3.Order1Handler
local noob = {"h", "hi"}
local idiot = {"l", "lo", "lol"}

    if Order1.Text == noob[1] or Order1.Text == noob[2] then
    print("noob")
    elseif Order1.Text == idiot[1] or Order1.Text == idiot[2] or Order1.Text == idiot[3] then
        print("idiot")
end

end)

If this helped mark this as the answer!

Ad
Log in to vote
0
Answered by 4 years ago

Hey. I think I see the issue, I am not sure if it will work though! When doing prints with shortcuts, you don't have to put the ""s. ` This script should work properly.

01 script.Parent.BackGround3.Enter.MouseButton1Click:connect( function() 02 local Order1 = script.Parent.BackGround3.Order1Handler 03 local noob = {"h", "hi"} 04 local idiot = {"l", "lo", "lol"} 05
06 if Order1.Text == noob[1 or 2] then 07 print(noob) 08 elseif Order1.Text == idiot[1 or 2 or 3] then 09 print(idiot) 10
11 end 12 end)

There is a chance that I have understood what you meant wrong, though. If so then let me know!

0
Oh wait I pasted it wrong. I just realized that I pasted the code wrong, just dont put the ""s in the prints. SellDoors 8 — 4y
0
It's better if you made a code block. :eyes: raid6n 2196 — 4y

Answer this question