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

Help with Chatted event, not printing?

Not printing "A" when Player1 says "kill" or "Kill". Thanks for helping!

game.Players.PlayerAdded:connect (function(player)
	if player.Name == "Player1" then
		player.Chatted:connect (function(msg)
			if msg:lower() == "Kill" then
    			print"A"
			end
		end)
	end 
end)

1 answer

✓ Accepted answer

msg:lower() converts all the characters to lower case, but you are comparing it to a string with an uppercase letter (the 'K' at the beginning). Therefore, the condition will never return true.

if msg:lower() == "kill" then
	print("A")
end

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