I want to make a script which takes a folder, and then looks for all of the selection boxes and turns their color property and thickness property to predetermined values.
However, when I do this, sometimes it works as intended and sometimes it simply doesn’t.
I’ve think it may be because I am using content provider, but I do not know why it would cause this to happen.
local ContentProvider = game:GetService("ContentProvider")
local room = script.Parent.Parent.Parent
ContentProvider:PreloadAsync(room:GetDescendants(), print("Neon Loaded."))
local colour = script.Parent.NeonColour.Value
local thickness = script.Parent.LineThickness.Value
for i, v in pairs(room:GetDescendants()) do
if v:IsA("SelectionBox") then
v.Color3 = colour
v.LineThickness = 0.1
end
end
local button = room.Button
button.Color = colour
local light = button:FindFirstChild("PointLight")
if light then
light.Color = colour
end
Above is the code I am using. Is there anyway I can load everything within the room without it just not working?