So I have this damagable model with a humanoid inside of it, and it works fine until it is killed a second time. After the humanoid is killed, it is destroyed, and cloned from replicatedstorage after the cooldown. It successfully is cloned, and takes damage correctly, however the GetPropertyChangedSignal function is never triggered. I’ve looked at similar issues with respawning npc humanoids, but they dont seem to correlate with my issue.
The damage is coming from server scripts, and since this is also a server script it should be able to detect the damage, but it doesn’t
(line 19 is where it is spawned)
local Humanoid = game.ReplicatedStorage.Humanoid
Humanoid.MaxHealth = 100
local human = script.Parent:FindFirstChild("Humanoid") or Humanoid:Clone()
human.Parent = atm
human:GetPropertyChangedSignal("Health"):Connect(function()
if COOLDOWN == false and atm:WaitForChild("Humanoid").Health <= 0 then
robbed = true
game.ReplicatedStorage.health:FireAllClients(robbed == true)
COOLDOWN = true
sound:Play()
close.Transparency = 1
close.CanCollide = false
open.Transparency = 0
open.CanCollide = true
script.Parent:FindFirstChildOfClass("Humanoid"):Destroy()
wait(cooldown_time)
COOLDOWN = false
local human = Humanoid:Clone() -- where the humanoid is spawned again
human.Parent = atm
close.Transparency = 0
close.CanCollide = true
open.Transparency = 1
open.CanCollide = false
end
end)
