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

How do i make a onChatted thign that only listens to ME!? Like if i say :Start

Asked by
Bwc904 0
10 years ago

PHow do i make a onChatted thign that only listens to ME!?

2 answers

Log in to vote
0
Answered by 10 years ago
local function onChatted(msg, speaker)
    local source = speaker.Name:lower()
    msg = msg:lower()
    if speaker.Name == "YourName" then
    --do h4x there
    end
end
0
Kidna what i need but i need it like kholes admin where if i Chat :Start Bwc904 0 — 10y
Ad
Log in to vote
0
Answered by
Bloxks 30
10 years ago

First, you would need to define the player, try the PlayerAdded event.

game.Players.PlayerAdded:connect(function(player) -- "Player" is defined for player's root. (The thing that holds Torso, head, humanoid, etc.
end)

After that, You would listen to player's chat.

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg) -- Listening... to chat.
    end)
end)

Finally, check the player's chat and check if it's the creator. Also check the message.

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        if player.userId == player.CreatorId then -- Is the player the creator? If yes do
            if msg == ":Start" then -- Is it :Start? If yes do
                --[[ OMGHAX ]]
            end
        end
    end)
end)
0
Thanks! Bwc904 0 — 10y

Answer this question