打印字符属性返回空表?

huangapple go评论52阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年2月27日 05:45:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75575198.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定