function onChatted(msg, recipient, speaker) local source = speaker.Name msg = string.lower(msg) if string.sub(msg,1,5) == "Sell " then if workspace:findFirstChild(speaker.Name) == nil then return end if workspace:findFirstChild(speaker.Name).Humanoid.Health <= 0 then return end if string.sub(msg,6) == "Gun" then --Change this for every gun name. if speaker.Backpack:findFirstChild("Gun") ~= nil then speaker.Backpack.Gun:destroy() speaker.leaderstats.cash.Value = speaker.leaderstats.cash.Value+50 end end end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end game.Players.PlayerAdded:connect(onPlayerEntered)
The reason why is because you made it detect it lowercase so this is how it would be if you wanted it lowercase:
function onChatted(msg, recipient, speaker) local source = speaker.Name msg = string.lower(msg) if string.sub(msg,1,5) == "sell " then if workspace:findFirstChild(speaker.Name) == nil then return end if workspace:findFirstChild(speaker.Name).Humanoid.Health <= 0 then return end if string.sub(msg,6) == "gun" then --Change this for every gun name. if speaker.Backpack:findFirstChild("Gun") ~= nil then speaker.Backpack.Gun:destroy() speaker.leaderstats.cash.Value = speaker.leaderstats.cash.Value+50 end end end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end game.Players.PlayerAdded:connect(onPlayerEntered)