Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i kill players who don't wear specific hat?

I want to make space game, and i want to make script which will kill players if they don't wear space hat when they leave room.

Or script which instantly wear hat on spawned player.

1 answer

Kill instantly:

while true do
wait()
for i,v in ipairs(game.Players:GetChildren()) do
if v.Character then
if v.Character:FindFirstChild("HATNAME") == nil then
v.Character:BreakJoints()
end
end
end

Kill slowly:

while true do
wait()
for i,v in ipairs(game.Players:GetChildren()) do
if v.Character then
if v.Character:FindFirstChild("HATNAME") == nil then
v.Character.Humanoid.Health = v.Character.Humanoid.Health - 1
end
end
end

If this doesn't work then i'm sorry. I didn't test it

This discussion is preserved as it was. New answers, comments, and votes are closed.