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

How can I use OnChatted?

Imagine I said "Activate teleport blah bloo" in the chat, how would I check if I say that then do somthing if it is true. IS THIS RIGHT? ///// here is an example of my code :


	
Admins = {"doctorbenny2011"}



function onChatted(msg) 

if msg == ("Activate teleport blah bloo")then
--cool code here
end
end
	
game.Players.PlayerAdded:connect(function (guy)
	for i,v in pairs(Admins) do
		if string.lower(guy.Name) == string.lower(v) then
			guy.Chatted:connect(onChatted)
		end
	end
end) 

2 answers

✓ Accepted answer
--A Harder way maybe? idk. I once tried this and it worked.

game.Players:WaitForChild('YourName').Chatted:connect(function(msg) -- Put your name in ('YourName')
        if msg:lower():sub(1,222132) == 'prt' then
                 print('Chatted') -- Prints Chatted everytime you say prt.
          end
end)

1 comment

0

By the way string.lower() is just another way of not capitalizing a name or something.

here is an article on the wiki that i think will help you out

http://wiki.roblox.com/index.php?title=Chat_commands

5 comments

0

No, it doesn't help.

0

Then what dont you understand exactly

0

Right, it's a multi word msg so I need to know how I can make somthing happen when those words are said by me.

0

i think you have it for the most part just make sure you type the message perfectly

0

Nope.

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