[Plugin] My checking script won't work

Core:FindFirstChild("TextButton").Activated:Connect(function()
	for _,v in pairs(game:GetDescendants()) do
		local i = Core:FindFirstChild("Template"):Clone()
		i.Parent = Core.BG
		i.Text = v.Name
		i.Name = v.Name
		i.Visible = true
	end
end)

So basically, this script just gets all the descendants of the game and clones them into a textlabel and clones it into the scrolling frame. The thing is, it’s not working.

Edit:

I think it has something to do with the TextButton because I used the script in InCommand and it worked fine.

I tried that but that wont work either

local toolbar = plugin:CreateToolbar("View Game Descendants")

local uiButton = toolbar:CreateButton("Open UI", "Open Game Descendants Viewer", "rbxassetid://5085732245")

local Core = script.Parent:FindFirstChild("Core")

script.Parent:FindFirstChild("Core"):Clone().Parent = game:GetService("CoreGui")

Core:FindFirstChild("TextButton").MouseButton1Click:Connect(function()
	for _,v in pairs(game:GetDescendants()) do
		local i = Core:FindFirstChild("Template"):Clone()
		i.Parent = Core.BG
		i.Text = v.Name
		i.Name = v.Name
		i.Visible = true
	end
end)

(This Is Just For Testing)
Edit: Also, sorry for the late response before. I was having a shower :rofl:

Try doing that don’t leave a space in = and brackets then it might work

Sorry, where specifically?

Use WaitForChild instead of FindFirstChild.

In the lines starting from Local

Edit: what are you making??

Here? local i = Core:FindFirstChild("Template"):Clone()

Also, i’m making a plugin that views everything in the game.

@Safi683 Spaces don’t matter.

Secondly, for looping through the game’s descendants will return an error of lacking permissions, because plugins do not have access to everything, so put it in a pcall.

Thirdly, if this is a script managing clicks it should be done like this:

function onClick()
	for _,v in pairs(game:GetDescendants()) do
		local i = Core:FindFirstChild("Template"):Clone()
		i.Parent = Core.BG
		i.Text = v.Name
		i.Name = v.Name
		i.Visible = true
	end
end
Core:FindFirstChild("TextButton").MouseButton1Click:Connect(onClick)
1 Like

Yes I forget You are true (30 chara)

I’m thinking, should I just make it for each service such as Workspace instead of the whole game?

Yes that might work ( 30 char )

If you wrap it in a pcall you’ll be fine.

function onClick()
    pcall(function()
	    for _,v in pairs(game:GetDescendants()) do
		    local i = Core:FindFirstChild("Template"):Clone()
		    i.Parent = Core.BG
		    i.Text = v.Name
		    i.Name = v.Name
		    i.Visible = true
        end
    end)
end
Core:FindFirstChild("TextButton").MouseButton1Click:Connect(onClick)

Something like this should work; I did something similar to this for a script character & script amount counter.

You could also loop through each service, but it’d be less efficient

1 Like