英文:
Getting on click using getchildren()
问题
我有一个在Roblox Studio中的区域,上面有从0到9的按钮编号,我想获取该文件夹中的所有子项,并获取它们所有的点击检测器,但我不知道该如何做。请帮忙,谢谢。
已成功获取子项,但未成功获取点击检测器。
英文:
I have an area which has button numbers from 0 to 9 on roblox studio and I want to get all the children from that folder and also get the clickdetector for all of them but I dont know how. Please help thank you.
Managed to get the children but didnt manage to get the click detector
答案1
得分: 1
我假设您也想为所有按钮获取点击检测器,所以这里是代码:
local folder = --引用
local t = {}
for i,v in pairs (folder:GetChildren()) do
if v:FindFirstChild("ClickDetector") then
table.insert(t,v)
end
end
--现在您可以做您想做的任何操作,因为您已经拥有了您想要的对象/按钮
英文:
I assume you also want to get the click detector for all of the buttons, so here you go.
local folder = --reference
local t = {}
for i,v in pairs (folder:GetChildren()) do
if v:FindFirstChild("ClickDetector") then
table.insert(t,v)
end
end
--do whatever you want next now because you have the objects/buttons you want
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论