I have a Day and Night Cycle script in my game inside of game.ServerScriptService and I have a local script that gets Descendants added to the game. As the time of day inside lighting changes, the local script picks up objects that are added to the game? but when the day and night cycle script is disabled, I do not get this error in the output.
Is there a way for me to get around the error being shown in the output?
I’m prety sure this is triggered by this kind of code since I am not allowed to read that object.
local function OnDescendantAdded(Descendant)
if Descendant:IsA(InstanceType) then
--code goes here
end
end
game.DescendantAdded:Connect(OnDescendantAdded)
I don’t have an issue with my day and night cycle script , I’m just asking if there is a way to go around errors thrown when hidden objects are detected during class checks.
local function OnDescendantAdded(Descendant)
if success then
if Descendant:IsA(InstanceType) then
--code goes here
end
end
end
Success, ErrorMessage = pcall(OnDescendantAdded)