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

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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
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. Nonaz_jr 439 — 6y
Ad
Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago

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)

Answer this question