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.
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
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)
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