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

Simple chat command not working?

Asked by
bloxxyz 274 Moderation Voter
8 years ago

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

Log in to vote
-2
Answered by
KordGamer 155
8 years ago

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!

Ad

Answer this question