I Cannot Think On How To Destroy A Part When Someone Dies, Plz Give Me Tips On How To Do IT i tried to script it but im only a beginning so i have no idea what im doing xD Plz HELP!
local Player = game.Players:GetPlayers() local Humanoid = Player:WaitForChild("Humanoid") if Humanoid.Health == 0 then script.Parent:Destroy() end
this is the error attempt to call method 'WaitForChild' (a nil value) i have no idea what to use instead?
Sorry I couldn't explain this to you earlier, I was short on time.
local Part = workspace.Part--assign "Part" the value of a part under the name "Part" in workspace local function armageddon() --A function that returns true when all the players have died after a certain point local alive = game.Players:GetPlayers()--create a list of all the players named "alive" for i,player in pairs(alive) do --a generic for loop that iterates through values of the table "alive" coroutine.resume(coroutine.create(function(num,player)--create a new thread with "num" and "player" as arguments if not player.Character then--if the player is already dead or doesn't have a character,run the following code table.remove(alive,num)--removes the player from the table return--stopes the coroutine from running end--end the if statement local died --define "died" locally died = player.Character:FindFirstChild("Humanoid").Died:connect(function() --assign "died" an event that runs when the player dies died:disconnect()--disconnects the "died" event, so it only checks if the player died once table.remove(alive,num)--removes the player from the table end)--ends the event end),i,player)--ends the coroutine and assigns it the values "i" and "player", being the iteration and the value. end--ends the for loop while #alive > 0 do--run the loop to block the rest of the code from running while at least one player is alive wait()--waits a small amount of time to prevent the game from crashing end--ends the while loop return true;--function returns true end--ends the function if armageddon() then --call the function when you want it to run Part:Destroy() --destroys the part end--ends the if statement