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

How do i use Chatted event of Player ?

Asked by 5 years ago

I used the exemple in wiki but what i tried is...

game.Players.PlayerAdded:connect(function(plr)
    plr.Chatted:connect(function(msg)
        print(plr.Name.. "say :"..msg)
    end)
end)

It didn't print what the player say.

Thanks

1
Is this in a Script or a LocalScript? Is it anywhere other than Workspace or ServerScriptService? NotInventedHere 158 — 5y
0
Because it’s using deprecated code. Let me rewrite it. User#19524 175 — 5y
0
i recommend that "say:" should be "says:". DeceptiveCaster 3761 — 5y
0
it makes grammatical sense that way DeceptiveCaster 3761 — 5y
0
it would display: ["xJathur95x says: "..msg]. Does that make sense? DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

It didn’t work because it uses deprecated code. RBXScriptSignal:connect() is deprecated, it is RBXScriptSignal:Connect(). It could also be that “Players” wasn’t found inside game so it’s always good to use DataModel:GetService(Instance className).

game:GetService(”Players”).PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg, recipient)
        print(plr.Name..” said: ”..msg
    end)
end)
0
Please note: deprecated does not means that it does not work. It’s just old and replaced by something else. Still functions normally tho. LeadRDRK 437 — 5y
0
Deprecated code can cause problems, just so you know. User#19524 175 — 5y
0
It’s like trying to run Windows 10 on a Windows 95 computer. User#19524 175 — 5y
Ad

Answer this question