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

OnChatted if statement help?

Asked by
VoltCode 101
7 years ago

(For example)

player.Chatted:connect(function(msg)
    if(msg == "y" or "yy") then
    -stuff
    else if(msg == "n" or "nn") then
    -stuff
    else
    --stuff
    end
end)

I tried doing that and it won't work. Any solutions/tips please?

0
(And yes player is declared) VoltCode 101 — 7y

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

If statements require a complete statement on every or, or and. Also, you use else if instead of elseif, which would make it require an extra end.

Fixed:

player.Chatted:connect(function(msg)
    if msg == "y" or msg == "yy" then
        --stuff
    elseif msg == "n" or msg == "nn" then
        --stuff
    else
        --stuff
    end
end)
Ad

Answer this question