if string.sub(message:lower(),1 ,8) == Settings.CommandsStart.."kill me" then
plr.Character.Humanoid.Health = 0
elseif string.sub(message:lower(), 1, 9) == Settings.CommandsStart.."kill all" then
for i,v in pairs(game.Players:GetChildren()) do
if v.Character.Humanoid then
v.Character.Humanoid.Health = 0
end
end
elseif string.sub(message:lower(),1,4) == Settings.CommandsStart.."kill" then
plr.Character.Humanoid.Health = 0
end
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(message)
if string.sub(message:lower(),1 ,8) == Settings.CommandsStart.."kill me" then
plr.Character.Humanoid.Health = 0
elseif string.sub(message:lower(), 1, 9) == Settings.CommandsStart.."kill all" then
for i,v in pairs(game.Players:GetChildren()) do
if v.Character.Humanoid then
v.Character.Humanoid.Health = 0
end
end
elseif string.sub(message:lower(),1,4) == Settings.CommandsStart.."kill" then
plr.Character.Humanoid.Health = 0
end
end)
end)
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(message)
if string.sub(string.lower(message),1 ,8) == Settings.CommandsStart .. "kill me" then
plr.Character.Humanoid.Health = 0
elseif string.sub(string.lower(message), 1, 9) == Settings.CommandsStart .. "kill all" then
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Character.Humanoid then
v.Character.Humanoid.Health = 0
end
end
elseif string.sub(string.lower(message),1,4) == Settings.CommandsStart .. "kill" then
plr.Character.Humanoid.Health = 0
end
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(message)
local FormattedMessage = string.sub(message:lower(), 1, 8)
print(FormattedMessage)
if FormattedMessage == Settings.CommandsStart.."kill me" then
plr.Character.Humanoid.Health = 0
elseif string.sub(message:lower(), 1, 9) == Settings.CommandsStart.."kill all" then
for i,v in pairs(game.Players:GetChildren()) do
if v.Character.Humanoid then
v.Character.Humanoid.Health = 0
end
end
elseif string.sub(message:lower(),1,4) == Settings.CommandsStart.."kill" then
plr.Character.Humanoid.Health = 0
end
end)
end)
You still should just check for that specific command alone & see if it works or not, or just lowering the string using string.lower() and not subbing it
Also I’m assuming that Settings.CommandStart is a prefix for the command?
Doing string.sub(whatever, 1, 8) will trim it down to the first 8 characters. Just trim it down to the length of the command you’re comparing to by changing the 8.
if string.sub(message:lower(), 1, 15) == Settings.CommandsStart.."Bubble Chat me" then
local Message = string.sub(message:lower(), 17)
Chat:Chat(plr.Character, Message)
end
elseif string.sub(string.lower(message), 1, 9) == Settings.CommandsStart .. "kill all" then
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
local hum = player.Character and player.Character:FindFirstChild("Humanoid")
if hum then hum.Health = 0 end
end