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

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

Asked by 3 years ago
Edited 3 years ago

This question has been solved by the original poster.

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!

0
Connect a print statement to a .Chatted event. https://developer.roblox.com/en-us/api-reference/event/Player/Chatted DinozCreates 1070 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago

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!

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! RazzyPlayz 497 — 3y
0
Done! WINDOWS10XPRO 438 — 3y
Ad
Log in to vote
-1
Answered by 3 years ago

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)
0
not the solution, I got the solution already. WINDOWS10XPRO 438 — 3y
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. Metacalled2 142 — 3y

Answer this question