im guessing you want to kill all players
for i = 10, 0, -1 do
status.Value = "liquidation:"..i
task.wait(1)
if i == 0 then
for i, v in pairs(game.Players:GetPlayers()) do -- v is the player
v.Character.Humanoid.Health = -1
end
end
end
if not you’ll have to specify the player, maybe using a RemoteEvent or anything else.
and replace the
for i,v in pairs(game.Players:GetPlayers()) do -- v is the player
v.Character.Humanoid.Health = -1
end
with:
player.Character.Humanoid.Health = -1
if you want only a single one to die
just do 0 -1 could cause bugs
so
Player:LoadCharacter will work and it’s instant …
LoadCharacter doesn’t necessarily kill them in the same way, since they don’t break joints or use the proper respawn time
I want to kill those players who are in the game zone
well, if you’d want to do such thing u just have to check once “i” becomes 0, and then just destroy all the current players in the game
I don’t need to kill everyone. I only need to kill the players who are in the play area (in my case 2 players)
so like, u wont kill the whole server just the ones in the play area?
exactly. within 10 seconds, the players in the game zone must die. and those who are waiting in the lobby should not die.
I was prompted to use remote event, but I do not know how it works because I have only been studying for 2 weeks
nice, but the thing is when u sended ur code u only sended the code that includes the timer, so u could basically check all the players in the playzone and then make a loop and then destroy them
like shown here:
for i = 10, 0, -1 do
status.value="liquidation:"..i
task.wait(1)
if i == 0 then
// now for this part u either already must have a variable containing all the current players in the playzone
for i, v in pairs(players_in_playzone:GetChildren()) do
v:Destroy()
end
end
and sorry i am really not good with this posting type thing and it must have alot of syntax errors
and i’d like to know if u are running this on a localscript or a serverscript and also where is the script located at
you could use teams like this:
local team = game.Teams. -- your team
for i = 10, 0, -1 do
status.Value = "liquidation:"..i
task.wait(1)
if i == 0 then
for i, v in pairs(team:GetPlayers()) do -- v is the player
v.Character.Humanoid.Health = 0
end
end
end
and dont forget to set their team when they go to the area.
this uses part hitbox so you dont have to set teams, just set the area variable to your hitbox
also sorry for the messy code and formatting, ive written this in a hurry
local function GetTouchingParts(part) -- // gets the touching parts even if the area part has collision set to false
local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
connection:Disconnect()
return results
end
local area = ...
for i=10, 0, -1 do
status.Value = `liquidation: {i}`
task.wait(1)
if i == 0 then
local parts = GetTouchingParts(area)
for _, a in pairs(parts) do
if a.Parent then
if a.Parent:IsA("Model") and a.Parent:FindFirstChildWhichIsA("Humanoid") then
a.Parent:FindFirstChildWhichIsA("Humanoid"):TakeDamage(math.huge)
end
end
end
end
end