Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Item in workspace cant be accessed ? [Solved]

Asked by
Gunt_r 31
4 years ago
Edited by DeceptiveCaster 4 years ago

This question has been solved by the original poster.

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
0
You are doing worksapce.Model and not getting the children of Model first before trying to go through them. MrLonely1221 701 — 4y
0
workspace:WaitForChild("Model") on line 1 instead of workspace.Model, and workspace.Model:GetChildren() instead of workspace.Model on line 5 DeceptiveCaster 3761 — 4y
0
Is it archivable? WillBe_Stoped 71 — 4y
0
yeah it was archivable Gunt_r 31 — 4y

1 answer

Log in to vote
0
Answered by
Gunt_r 31
4 years ago

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
Ad

Answer this question