#I need help making a respawn system for my spawning system and idk how to track if my npc has died
1 messages · Page 1 of 1 (latest)
npc.Humanoid.Died:Once(function()
-- code
end)
this connection fires once and disconnects once the npc dies
npc is well the npc
But thats the thing
what
npc is always a different model
so what's the issue
if you want to implement it easier you can put a script with the code into the dummy
Yeah well but how would I get it
but if you want to do it the proper way you could put it in the spawn function
how are you spawning it then
Wouldn't I need to fire a remote event
how are you spawning it
I'll send tmrw I'm not on my pc
ok
the npc is a rig right?
Yep
if it is a rig then just do
GetPropertyChangeSignal()
and connect it into a function
check if the health of the humanoid is 0 or below
like this
workspace.Rig.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if workspace.Rig.Humanoid.Health <= 0 then
end
end)
I'll try it tmrw
what's wrong though
disconnects the event once it triggers
you've never heard of once?
it's important to disconnect unused connections
it's the main cause of memory leaks if i recall correctly
no problem i guess
idk how I have never heard of that
I HAVE BEEN SCRIPTING LUAU ALMOST EVERY DAY FOR A YEAR
you can also manually disconnect connections incase you didn't know
LIL OVER A YEAR ACUALLY
personally i've been scripting for like 3-4 years
man I still got ways to learn
yeah I been programming since 5th grade, but like easy programming
but luau since 2024
