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

[Answered] How do I make a script that checks the player's chat?

Example: /say Hello!

then it checks the message after /say and it will be printed out in the developer console, I have no idea how I can make it. I wanted to make a /say script. you can type anything after /say and it will be printed out at the dev console. Thanks!

1 comment

0

Connect a print statement to a .Chatted event. https://developer.roblox.com/en-us/api-reference/event/Player/Chatted

2 answers

✓ Accepted answer

Wait, I know about this I just forgot ;-; but thanks for the quick respond!

local command = "/say "

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Chat)
		if string.sub(Chat, 1, 5) == command then
			local text = string.sub(Chat, 6)
			print(text)
		end
	end)
end)

This is the solution!

2 comments

0

Nice! Congratulations on having found the solution to your issue! Make sure to put the tag [Answered] in the title, so others know that this is solved and so that other developers can come back to this knowing it's solved!

0

Done!

this maybe idk

game.Players.PlayerAdded:connect(function(player)
	player.Chatted:Connect(function(message)
		if message == "/example" then
			--add a code
		elseif message == "/example2" then
			--add a code
		end
	end)
end)

2 comments

0

not the solution, I got the solution already.

0

Kak, can you stop rep farming with useless code, are you here to help people or not? He clearly said something like "/say hello" not a certain message executes certain code. - you also reply with answers to questions you don't even understand even to the slighest.

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