I'm trying to make a game where there's an NPC and if you say nice things to it, it will shrink. I want it so that there is multiple words that it will accept. I also want it so that you have to include the word in a message, not have to type out only the exact word. I've made some code for this but it only works if you use the first value, "cool". Can someone help me fix this? Thanks!
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if string.match(string.lower(msg), "cool" or "epic" or "rad" or "coolest" or "fan" or "small" or "fun" or "funny") then
print("OK 3")
ChatService:Chat(part, "O_O", "White")
local Humanoid = model.Humanoid
if Humanoid then
local HS = Humanoid.HeadScale
local BDS = Humanoid.BodyDepthScale
local BWS = Humanoid.BodyWidthScale
local BHS = Humanoid.BodyHeightScale
HS.Value = HS.Value - 0.1
BDS.Value = BDS.Value - 0.1
BWS.Value = BWS.Value - 0.1
BHS.Value = BHS.Value - 0.1
print("Shrunk!")
end
end
end)
end)

2 comments
Thanks, I'll have to try that later!
There are two problems with this code. The first one is when I say "cool" in chat, it runs the code twice. And the second problem is that if I used the words in a sentence (for example, "ur rad") the code will not run. I also renamed Words to niceWords because I'm planning on making it so that when you say something mean the person grows.