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

How do I detect when any player says something and then it affects a parts properties?

I tried doing,

game.Players.PlayerAdded:connect(function(player) if player.Name == "Player" then player.Chatted:connect(function(msg)

    end)
end

end)

But that just detect if one player says something. I'm trying to make it so that if anyone says something it'll effect the position/transparency of a part.I already know hoe to do the second part, I just don't know how to make it detect any players chat. (I got this information from the roblox wiki)

2 answers

Running a script every time someone says something specific in chat.

game.Players.PlayerAdded:connect(function(player) if 
    player.Name == "Player" then 
        player.Chatted:connect(function(msg)
            if msg:lower() == "command" then
                -- // Do stuff
            end
        end)
    end
end)

Without a command and activates every time the set person chats.

game.Players.PlayerAdded:connect(function(player) if 
    player.Name == "Player" then 
        player.Chatted:connect(function(msg)
            -- // Do stuff
        end)
    end
end)

1 comment

1

This works only for the player named 'Player'. From what I understand, OP wants have it work for everyone, so to just remove that if-statement. This works nicely to implement admin commands though.

why dont you just remove the part

if player.Name == "Player" then

and dont forget to remove the "end" after the "end)" belonging to player.Chatted:connect(function(msg)

(so the "end" in line 2 of the codeblock in your post)

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