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

Item in workspace cant be accessed ? [Solved]

Im getting an error that an object is not in workspace but is in it. im trying to get "Model". im calling it through "workspace.Model"

Anyone know what's wrong?

png of explorer: https://cdn.discordapp.com/attachments/165226280118255616/670199794450432000/unknown.png

if it helps, here is the script

--repeat wait() until workspace.Model
wait(2)
while true do
	wait(10)
	for i, item in workspace.Model do
		if item.Name == "WeldConstraint" and item.Part0 == nil and item.part1 == nil then
			item.Enabled = false
		end
		print("Script Ran!!")
	end
end

4 comments

0

You are doing worksapce.Model and not getting the children of Model first before trying to go through them.

0

workspace:WaitForChild("Model") on line 1 instead of workspace.Model, and workspace.Model:GetChildren() instead of workspace.Model on line 5

0

Is it archivable?

0

yeah it was archivable

1 answer

Someone on the discord server answered the question. Here is the fix.

local Model = workspace:FindFirstChild('Model')

repeat wait() until Model

Model = Model:GetChildren()

while wait(10) do
    for i, item in Model do
        if item.Name == "WeldConstraint" and item.Part0 == nil and item.part1 == nil then
            item.Enabled = false
        end

    end

end

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