****so im making a game where once u beat the final boss a cutscene will play but i dont know how to check if the npc boss is dead. I tried if script.Parent.Humanoid.Health == 0 then
--- play the cutscene
end
but it doesnt work. help?****
This should work, I'm pretty sure the died function isn't deprecated.
local character = script.Parent character:WaitForChild("Humanoid").Died:Connect(function() print(character.Name .. " has died!") end)
You need to use HUMANOID.Died
here is page on wiki: Humanoid.Died - Wiki
Here is a example:
local npc_humanID = script.Parent:WaitForChild("Humanoid") npc_humanID.Died:Connect(function() print("The npc " .. script.Parent.Name .. " died!") end)
for play cutscene:
local npc_humanID = script.Parent:WaitForChild("Humanoid") npc_humanID.Died:Connect(function() local cutscene = game:GetService("ReplicatedStorage").Cutscene -- Cutscene Location for i,v in pairs(game.Players:GetPlayers()) do if v.Character ~= nil then cutscene:Clone().Parent = v.Character end end end)
Hope it helped :)
Errors? tell-me on comments.