Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local message = "im so lonely"
- local allowedChars = "abcdefghijklmnopqrstuvwxyz "
- allowedChars = allowedChars:split("")
- local createNPCs = require(script:WaitForChild("CreateNPCs"))
- function filterMessage(msg: string)
- msg = msg:lower()
- local filteredMsg = ""
- for _, char in pairs(msg:split("")) do
- if table.find(allowedChars, char) then
- filteredMsg = filteredMsg .. char
- end
- end
- return filteredMsg
- end
- game.Players.PlayerAdded:Connect(function(plr)
- plr.Chatted:Connect(function(msg, _recipient)
- msg = filterMessage(msg)
- if msg == message then
- createNPCs(plr)
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement