this is my first attempt at for i,v in pairs() do so i got no idea what im doing wrong and i get no errors from this this is my local script
local player = game.Players.LocalPlayer
player.Chatted:Connect(function(msg)
if msg:lower() == "kill all" then
for i,v in pairs(game:GetService("Players"):GetChildren()) do
if v.ClassName == "Player" then
local players = v
game:GetService("ReplicatedStorage"):WaitForChild("killall"):FireServer(players)
end
end
end
end)
btw i have the msg function already and this is my server script
game.ReplicatedStorage:WaitForChild("killall").OnServerEvent:Connect(function(players)
players.Character.Humanoid.Health = 0
end)

3 comments
btw when this is being used it only kills the player who said it
Not sure how much of a difference this would make, but try changing "v.ClassName == "Player"" to "v:IsA("Player")"
didnt work sadly, still has the same effect