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

Function not running when correct message is sent?

I'm trying to make a tool that when you say a certain message a function is preformed. My code:

local text = "text"

local function onPlayerChatted(player, message)
	if message:sub(1, text:len()):lower() == text then
		print("working")
	end
end

The message:sub part came from developer hub, I know i'm doing something wrong, but, I can't find any tutorials that work with what i'm trying to make. Is there any way I can fix this?

1 comment

0

What are you trying to do?

1 answer

You need to put

 player.Chatted:Connect(onPlayerChatted)

at the end or else the function will never run.

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