tried that and it still dosent work
also note that this error only happens in studio, not in game. it just makes testing 10x harder
oh wait, try 65 then, as i have a folder in game, which made the total child count of game 107 instead of 106.
As @BendsSpace said, just wrap it in pcall. Because relying on this service number is not safe, if roblox adds another one the error will reappear.
module.ClearAttribute = function(plr)
pcall(function()
for i,v in pairs(game:GetDescendants()) do
if v:GetAttribute("Ownership") == plr.Name then --line 28
if v.Name ~= "dang" then
v:Destroy()
else
v:Destroy()
if not game.Lighting:FindFirstChild("dang") then
local sky = script.Sky:Clone()
sky.Parent = game.Lighting
game.Lighting.Brightness = 1
game.Lighting.Ambient = Color3.fromRGB(244,244,244)
end
end
end
end
end)
end
that may work, but i just used a pcall as someone suggest above
ex:
module.ClearAttribute = function(plr)
for i,v in pairs(game:GetDescendants()) do
local er,suc = pcall(function()
if v:GetAttribute("Ownership") == plr.Name then
if v.Name ~= "dang" then
v:Destroy()
else
v:Destroy()
if not game.Lighting:FindFirstChild("dang") then
local sky = script.Sky:Clone()
sky.Parent = game.Lighting
game.Lighting.Brightness = 1
game.Lighting.Ambient = Color3.fromRGB(244,244,244)
end
end
end
end)
end
end
ironic timing as i jsut used a pcall
yeah, though i found it errored at the 65th iteration even with the pcall, which is why i added the if statement.
This is a bug with the latest version of studio which is expected to be fixed in a week or so (see linked post), if you need a work around ASAP pcall is probably your only option for now.
using the pcall around the area where it loops the instances worked for me, not sure why it’d break
just make sure your using the pcall correctly around it
this is the post i was talking about in the post, glad its getting fixed soon
oops, i meant it just stops at the 65th iteration, not errors, i just wanted to loop through all the children in game without that silent error.
You probably resolved this already but for anyone looking for a shorter hotfix than pcall you can simply skip an item if it’s StreamingService itself.
for i, v in ipairs(game:GetChildren()) do
if v == game:GetService("StreamingService") then continue end -- Engine bug hotfix
-- (your code here)
end
oh thanks, i like this shorter version, it’ll keep my code clean.
This happened to me, it was because of the Animated Textures plugin. I uninstalled it and after that, everything was fine. No idea.
If you’re gonna do it like that, you may as well just not check every single thing in existance.
This will only check if the game’s children are StreamingService. So only about 110 instances rather than the 7000 I currently have in my game. And that’s a small one.
-- Works in both studio and roblox player
local StreamingService = game:FindFirstChild("StreamingService")
for _, service in ipairs(game:GetChildren()) do
if service == StreamingService then continue end
for _, descendant in ipairs(service:GetDescendants()) do
-- Your code here
end
end
Also, the reason why this happens in the first place is because they changed the StreamingService’s properties and functions to only be accessible to the AI assistant.
So for example, when you loop over all descendants and check their ClassName it tries to check the StreamingService’s ClassName at some point.
Best regards,
Pinker
Also, make sure you have some sort of check to make sure its studio in the first place since this only happens in studio and if you run this in the actual roblox it will result in an error because streamingservice doesnt exist there.
you can use RunService:IsStudio for this
so modify the line to:
EDIT - Made slight error in the code, you need to wrap the said line in an if statement
if game:GetService("RunService"):IsStudio() then
if v == game:GetService("StreamingService") then continue end
end
Actually, I’d like to add on to this. The game that I have been developing has ran into an issue with one of the core scripts doing this. This error seems to be affecting more than just scripts that people make on their own games, but some of the core features in the engine. I’ll provide an image below of my error. For context, I disabled every script in my game from running and this error still occurred. The entire basis of my game uses voice chat so a fix is quite needed.
Edit: This error occurs when I enable “UseAudioApi” in VoiceChatService.
I fixed this day ago, you need just turn AudioApi to automatic or just disable. (game.VoiceChatService.UseAudioApi)
some people may need it so that isnt a reliable fix, but its luckily getting a patch if it hasent been already
Yeah, i know, just saying how i fixed this