英文:
Printing out character properties returns a blank table?
问题
在Roblox中,我试图打印出角色属性的完整表格,但当我打印它时,表格是空的。
我尝试等待角色被创建,然后获取它的子元素,我期望它会打印出所有内容,但什么都没有被打印出来。
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
print(Character:GetChildren())
英文:
In Roblox, I'm trying to print out the full table of properties from the character but when I do print it out, the table is empty.
I tried waiting for when the character was created and then getting its children, and I was expecting it to print out literally everything but nothing was being printed.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
print(Character:GetChildren())
答案1
得分: 1
在你执行print
之前,添加一个wait()
。
在CharacterAdded:Wait()
信号后,允许你的本地脚本临时让出控制权,这将为引擎添加子元素提供足够的时间。
英文:
Right before you print
, add a wait()
.
Allowing your localscript to temporarily yield after the CharacterAdded:Wait()
signal will give just enough time for the engine to add the children.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论