for i, v in {workspace, game.ReplicatedStorage, game.ReplicatedFirst, game.StarterGui, game.StarterPack} do
for i,v in v:GetDescendants() do
if v:IsA("BasePart") then
print("Test")
end
end
end
i dont know why my answer got deleted, but here is some explanation
StreamingService is child of DataModel.
According to error
Regular scripts can’t mess with that except for scripts with higher permissions.
the current solution is don’t use game:GetDescendants()
use the merged table of multiple objects
like this
for i, v in {workspace, game.ReplicatedStorage, game.ReplicatedFirst, game.StarterGui, game.StarterPack} do
for i,v in v:GetDescendants() do
if v:IsA("BasePart") then
print("Test")
end
end
end
Thank you for the report. We’ve identified the issue and expect a fix to ship with the Studio release next week. This issue should only affect Studio sessions and not production servers.
If you need a workaround in the meantime, you can wrap the if statement in a pcall:
for _, v in game:GetDescendants() do
pcall(function()
if v:IsA("BasePart") then
print("Test")
end
end)
end
I believe that external features may have a role in some of these errors. My game that has several contributions on it is getting this error even when I remove and disable all uses of game:GetDescendants() like the one used in our loading screen.