PHow do i make a onChatted thign that only listens to ME!?
COMMUNITY QUESTION
How do i make a onChatted thign that only listens to ME!? Like if i say :Start
2 answers
local function onChatted(msg, speaker)
local source = speaker.Name:lower()
msg = msg:lower()
if speaker.Name == "YourName" then
--do h4x there
end
end
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)
1 comment
0
Thanks!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Kidna what i need but i need it like kholes admin where if i Chat :Start