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

Can i make a local script that detects what a other player says?

Asked by 5 years ago

Can i make a local script that detects what a other player says? Like, run (Script) when you detect (Other player's message)

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

Sure, just connect Chatted to other players, except in a localscript. You will have to account for already existing players tho, instead of just connecting to PlayerAdded.

local function Chatted(plr, msg)
    print(plr,"said",msg)
end

local function PlrAdded(plr)
    plr.Chatted:Connect(function(msg)
        Chatted(plr msg)
    end)
end
game.Players.PlayerAdded:Connect(PlrAdded)

for i,v in pairs(game.Players:GetPlayers()) do
    PlrAdded(v)
end
0
How can i make it run something when a specific player says a specific message? GodlyEricGamer1800 -100 — 5y
Ad

Answer this question