Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make it after a npc dies, a gui pops up?

I'm trying to make it so if you kill the npc with the script inside, a gui will pop up. But nothing is happening, help!

	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if
	humanoid.Health == 0
	then
	game.StarterGui.ScreenGui.Frame.Visible = true

Thanks if you can help, I am also a bit of a noob, so go easy on me!

2 answers

connect it to the humanoid.died function

wait(1)
local p = game:GetService("Players").LocalPlayer
local c = p.Character
local h = c:WaitForChild("Humanoid") 
h.Died:Connect(function()
	--show your gui
end)

1 comment

0

I agree.

Organization is essential. Try making a clean and correct syntax:

-- Made by Lunatic_o;


local human = -- Your humanoid here;

if human.Health <= 0 then

-- Your action here

end -- Don't forget the "end" it is important;

This discussion is preserved as it was. New answers, comments, and votes are closed.