Hello. Attempting to put a despawner in a vehicle owning script, every time I reset with my vehicle, the despawn countdown does not begin.
script.Parent.OwnIt.Occupant:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.OwnIt.Occupant.Value == "NoOccupant" then
for _, billboard in pairs(script.Parent.Parent:GetDescendants()) do
if billboard.Name == "DespawnGui" then
billboard.Enabled = true
for i = 80, 0, -1 do
if script.Parent.OwnIt.Occupant.Value == "NoOccupant" then return end
billboard.TextLabel.Text = "Despawning in: " .. i
wait(1)
end
script.Parent.Parent:Destroy()
end
end
elseif script.Parent.OwnIt.Occupant.Value ~= "NoOccupant" then
for _, billboard in pairs(script.Parent.Parent:GetDescendants()) do
if billboard.Name == "DespawnGui" then
billboard.Enabled = true
billboard.TextLabel.Text = "Despawn timer starts when player resets"
end
end
end
end)