Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Mokiros 135
10 years ago

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

Log in to vote
0
Answered by 10 years ago

Kill instantly:

1while true do
2wait()
3for i,v in ipairs(game.Players:GetChildren()) do
4if v.Character then
5if v.Character:FindFirstChild("HATNAME") == nil then
6v.Character:BreakJoints()
7end
8end
9end

Kill slowly:

1while true do
2wait()
3for i,v in ipairs(game.Players:GetChildren()) do
4if v.Character then
5if v.Character:FindFirstChild("HATNAME") == nil then
6v.Character.Humanoid.Health = v.Character.Humanoid.Health - 1
7end
8end
9end

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

Ad

Answer this question