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

Simple chat command not working?

It doesn't look like I'm getting an error, I just want a script where when you say "hello" it will give you back your name. I've taken this directly from the wiki, and tweaked it a bit. Anyone see the problem? I just don't. Thanks!


function onChatted(msg, recipient, speaker)
msg = string.lower(msg)
if msg == "hello" then
	print(speaker.Name)
end
end

1 answer

Hi bloxxyz,

Your function doesn't work because you didn't tell the system to 'fire' the function upon doing something.

You can do this by using the .Chatted script signal by doing something like this:

game.Players.LocalPlayer.Chatted:connect(OnChatted)

If I helped you, Please consider accepting the answer! Thanks!

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