Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] Check for a Sky?

I am currently in the process of creating a plugin. The purpose of that plugin is to allow the user to choose sky boxes freely.

I want my plugin to check "Lighting" to see if there is already an item that is a "Sky"

If there isn't already a sky in Lighting, I will add one.

Here's what I have...

Sky = Instance.new("Sky", game.Lighting) Sky.Name = SmartSky -- Adds a Sky named SmartSky

But how would I see if there's already another Sky in lighting. If there is, I don't want to create another. I just want to rename the one that's already there to "SmartSky"

If you understand what i'm looking for, please feel free to answer...

1 answer

✓ Accepted answer

found = false for _,v in pairs(game:GetService("Lighting"):GetChildren()) do if v:IsA("Sky") then found = true end end

Found is going to be whether or not a "Sky" is in Lighting

This discussion is preserved as it was. New answers, comments, and votes are closed.