roblox chatted function code example
Example 1: roblox lua on player chatted
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
-- do stuff with msg and player
end)
end)
Example 2: player chatted function roblox
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.sub(msg,1,10) == "hey" then
print(player.Name.." said hi!")
end
end
end)