I'm having a problem where an object value with a value equaled to the player's character doesn't recognize it when the player dies, therefore the character is destroyed. Even though the object doesn't exist, if I access the object through the object value instance it returns as if the character model exists. How can I fix this such that the object value's value become nil when the object doesn't exist any more.
Easy change it to nil
ObjectValue.Value = nil
or detect when object is destroyed do this
local Value = ObjectValue.Value local partParent = Value.Parent partParent.ChildRemoved:Connect(function(item) if item == Value then ObjectValue.Value = nil end end)