So, I wanted to make an explorer. It worked well at first, displayed all object in workspace.
I wanted to make a new button "View Children".
I added a thingy into my refresh function which was called "searchinto".
Instead of searching to workspace it would search to the variable.
I (wow lots of I's) also tried making it so when the script starts it executes the function refresh using refresh(_, game)
so it would search in game.
It displayed 2 textboxes which were Workspace and Run Service, and displays the error on line 97 and 158: Error occured, no output from Lua.
Actually, when you explore in workspace, the script doesn't error and works fine.
-- variables local me = game.Players.LocalPlayer minecraftsoftonic = game -- Create ScreenGui local screenGui = Instance.new("ScreenGui") screenGui.Parent = me.PlayerGui -- Create ScrollingFrame local scrollingFrame = Instance.new("ScrollingFrame") scrollingFrame.Position = UDim2.new(0.2, 0, 0.1, 0) scrollingFrame.Size = UDim2.new(0, 200, 0, 300) scrollingFrame.CanvasSize = UDim2.new(0, 200, 2, 0) scrollingFrame.BackgroundColor3 = BrickColor.Blue().Color scrollingFrame.Parent = screenGui scrollingFrame.ScrollingEnabled = true scrollingFrame.Active = true scrollingFrame.Draggable = true scrollingFrame.ScrollBarThickness = 12 -- Create SearchBar local s = Instance.new("TextBox", scrollingFrame) s.BackgroundColor3 = BrickColor.White().Color s.TextColor3 = BrickColor.Black().Color s.Size = UDim2.new(0,125, 0,50) s.Text = "Search" s.TextScaled = true s.Position = UDim2.new(0,0, 0,0) function refresh(word, tosearch) if not tosearch then tosearch = minecraftsoftonic end if word then for i,v in pairs(scrollingFrame:GetChildren()) do if v.Name == "Object" then v:Destroy() end end local i = 1 for index,v in pairs(tosearch:GetChildren()) do if string.lower(v.Name):match(word) then local txtbutton = Instance.new("TextButton", scrollingFrame) txtbutton.Position = UDim2.new(0,0, 0,50 * i) txtbutton.Text = v.Name txtbutton.Name = "Object" txtbutton.Size = UDim2.new(0,200, 0,50) txtbutton.MouseButton1Down:connect(function() local frame = Instance.new("Frame", screenGui) frame.Active = true frame.Draggable = true frame.BackgroundColor3 = BrickColor.Blue().Color frame.Position = UDim2.new(0,500, 0,100) frame.Size = UDim2.new(0,250, 0, 250) local n = Instance.new("TextButton", frame) n.BackgroundTransparency = 1 n.TextColor3 = BrickColor.White().Color n.Size = UDim2.new(0,125, 0,25) n.Text = v.Name n.TextScaled = true n.Position = UDim2.new(0,62.5, 0,0) local x = Instance.new("TextButton", frame) x.BackgroundColor3 = BrickColor.Red().Color x.TextColor3 = BrickColor.White().Color x.Size = UDim2.new(0,25, 0,25) x.Text = "X" x.TextScaled = true x.Position = UDim2.new(0,225, 0,0) x.MouseButton1Down:connect(function() frame:Destroy() end) local rb = Instance.new("TextButton", frame) rb.BackgroundColor3 = BrickColor.Black().Color rb.TextColor3 = BrickColor.White().Color rb.Size = UDim2.new(0,100, 0,50) rb.Text = "Destroy()" rb.TextScaled = true rb.Position = UDim2.new(0,75, 0,150) rb.MouseButton1Down:connect(function() v:Destroy() frame:Destroy() refresh() end) end) local i = i + 1 else end scrollingFrame.CanvasSize = UDim2.new(0, 200, 2, 0) + UDim2.new(0,0, 0,50 * i) end else for i,v in pairs(scrollingFrame:GetChildren()) do if v.Name == "Object" then v:Destroy() end end local i = 0 for i,v in pairs(tosearch:GetChildren()) do local txtbutton = Instance.new("TextButton", scrollingFrame) txtbutton.Position = UDim2.new(0,0, 0,50 * i) txtbutton.Text = v.Name txtbutton.Name = "Object" local i = i + 1 txtbutton.Size = UDim2.new(0,200, 0,50) txtbutton.MouseButton1Down:connect(function() local frame = Instance.new("Frame", screenGui) frame.Active = true frame.Draggable = true frame.BackgroundColor3 = BrickColor.Blue().Color frame.Position = UDim2.new(0,500, 0,100) frame.Size = UDim2.new(0,250, 0, 250) local n = Instance.new("TextButton", frame) n.BackgroundTransparency = 1 n.TextColor3 = BrickColor.White().Color n.Size = UDim2.new(0,125, 0,25) n.Text = v.Name n.TextScaled = true n.Position = UDim2.new(0,62.5, 0,0) local x = Instance.new("TextButton", frame) x.BackgroundColor3 = BrickColor.Red().Color x.TextColor3 = BrickColor.White().Color x.Size = UDim2.new(0,25, 0,25) x.Text = "X" x.TextScaled = true x.Position = UDim2.new(0,225, 0,0) x.MouseButton1Down:connect(function() frame:Destroy() end) local rb = Instance.new("TextButton", frame) rb.BackgroundColor3 = BrickColor.Black().Color rb.TextColor3 = BrickColor.White().Color rb.Size = UDim2.new(0,100, 0,50) rb.Text = "Destroy()" rb.TextScaled = true rb.Position = UDim2.new(0,75, 0,150) rb.MouseButton1Down:connect(function() v:Destroy() frame:Destroy() refresh() end) end) end scrollingFrame.CanvasSize = UDim2.new(0, 200, 2, 0) + UDim2.new(0,0, 0,50 * i) end end local g = Instance.new("TextButton", scrollingFrame) g.BackgroundColor3 = BrickColor.Green().Color g.TextColor3 = BrickColor.White().Color g.Size = UDim2.new(0,50, 0,50) g.Text = "Go!" g.TextScaled = true g.Position = UDim2.new(0,125, 0,0) g.MouseButton1Down:connect(function() refresh(s.Text) end) refresh(_, game) me.Chatted:connect(function(msg) if string.lower(msg) == "refresh" or string.lower(msg) == "ref" then refresh() end end)
This is a year old but I'm going to answer it so that it's not in the "unanswered" section and so people looking up a similar question can see an answer.
(Getting my information from this Devforum post.)
There are services that Roblox doesn't want you to use, direct children of the DataModel, and they are RobloxLocked. Attempting to index these values will error. You can stop this by using pcall()
to check for errors when you attempt to index it. Example code:
local function checkRobloxLocked(object) local success = pcall(function() local x = object.ClassName end) return not success -- return whether you could check classname end
You can call this function on an object to check if it's RobloxLocked before attempting to index it and thus avoiding errors.