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

OnChatted if statement help?

(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?

1 comment

0

(And yes player is declared)

1 answer

✓ Accepted answer

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)

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