Hey there,
for awhile now I have tried multiple to destroy the pets in my simulator game when a player resets, I have talked to people on the forum two, times about this and still I have not figured out a solution, so I am going to try again.
Every time someone resets, their pet should destroy through this script which is inside the pet
local TweenService = game:GetService("TweenService")
local Object = script.Parent
local NAME = Object.NameValue
wait(3)
if NAME.Value ~= nil then
local character = NAME.Value
script.Parent.Head.AlignOrientation.Attachment1 = character:WaitForChild("Head").NeckRigAttachment
else
Object:Destroy()
end
while true do
wait()
local character = NAME.Value
print(character.Humanoid.Health)
if character.Humanoid.Health >= 0 then
local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local tween = TweenService:Create(Object.Head, tweenInfo, {CFrame = character.Head.NeckRigAttachment.CFrame:ToWorldSpace(character.Head.CFrame * CFrame.new(2, 1, 1))} )
tween:Play()
else
Object:Destroy()
end
end
From what I see, it isn’t catching when the player gets reset, so it isn’t destroying, but I am out of ideas…
This issue becomes even stranger when this doesn’t work from my rebirth script…
for i, pet in pairs(game.Workspace.Pets:GetChildren()) do
if pet.NameValue.Value == player.Name then
print("Destroy PET!!!")
pet:Destroy()
end
end
this is what the pet looks like when it is connected to the character
I am hoping to FINNALY figure this out, does anyone see a potential problem or issue???