I’m not sure how to exactly print the player.Name from this without using for i,v loops.
Here is my current script:
game.ReplicatedStorage.KillAll.OnServerEvent:Connect(function(plr)
if plr.Name == 'Tyyuiss_RBLX' then
for i = 1, #game.Players:GetPlayers() do
print(i)
end
end
end)
I’m guessing this is what you want.
I hope you understand the notes I have provided for you.
local Players = game:GetService("Players")
game:GetActor("ReplicatedStorage"):WaitForChild("KillAll").OnServerEvent:Connect(function(caller)
if caller.UserId ~= 2528554414 then -- UserId > Username in case of username changes.
for _, player in pairs(Players:GetPlayers()) do
if player ~= caller then -- Remove this if you'd like to kill the player that called this event, too.
local character = player.Character
if typeof(character) == 'Instance' then
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if typeof(humanoid) == 'Instance' then
return humanoid:TakeDamage(humanoid.MaxHealth) -- Kill the player.
end
return character:BreakJoints() -- Break joints as a final result.
end
end
end
end
end)