I have a script that makes a print when I send a message. How do I make it only do the print if I say the words “Alakazam”
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
local character = Player.Character or Player.CharacterAdded:Wait()
if (Player.UserId == 210901995 or Player.Name == "slenderW0lf_YT") then
print ("Message Sent!")
end
end)
end)
To explain the .Chatted event fires for each player whenever they send a message to the built-in chat feature, the text contained within this message is passed as an argument to any callback function connected to the event so all you need to do is declare a parameter for that callback function (which in this case you’ve used “msg”) to handle this received value (the text as a string type value from the chat message).