I’m working on this game where a city is full of shadow creatures and when you try to kill one it immediately respawns. The thing is, it works, just a little too well…
Code:
script.Parent.Humanoid.Died:Connect(function()
local new = script.Parent:Clone()
new.Parent = game.Workspace
new:WaitForChild("Humanoid").Health = 100
local smokePart = Instance.new("Part", game.Workspace)
smokePart.Position = script.Parent.Torso.Position
smokePart.Anchored = true
smokePart.Transparency = 1
smokePart.CanCollide = true
smokePart.Size = Vector3.new(1,1,1)
local smoke = Instance.new("Smoke", smokePart)
smoke.Opacity = 1
smoke.Size = 1
smoke.Color = Color3.fromRGB(0,0,0)
smoke.RiseVelocity = 3
script.Parent.Eye1:Destroy()
script.Parent.Eye2:Destroy()
script.Parent:BreakJoints()
repeat wait()
smoke.Opacity = smoke.Opacity - 0.01
until smoke.Opacity <= 0
smokePart:Destroy()
script.Parent:Destroy()
end)
It’s meant to make one new clone but instead respawns uncontrollably.