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.
Kill instantly:
1 | while true do |
2 | wait() |
3 | for i,v in ipairs (game.Players:GetChildren()) do |
4 | if v.Character then |
5 | if v.Character:FindFirstChild( "HATNAME" ) = = nil then |
6 | v.Character:BreakJoints() |
7 | end |
8 | end |
9 | end |
Kill slowly:
1 | while true do |
2 | wait() |
3 | for i,v in ipairs (game.Players:GetChildren()) do |
4 | if v.Character then |
5 | if v.Character:FindFirstChild( "HATNAME" ) = = nil then |
6 | v.Character.Humanoid.Health = v.Character.Humanoid.Health - 1 |
7 | end |
8 | end |
9 | end |
If this doesn't work then i'm sorry. I didn't test it