繁体   English   中英

尝试用类人机器人索引 nil

[英]Attempt to index nil with humanoid

我尝试对加入游戏的玩家应用人形描述,但 output 给出错误:“尝试使用人形索引 nil”。 这是代码。

game.Players.PlayerAdded:Connect(function(Player)
    Player.Character.Humanoid:ApplyDescription(game.ServerStorage.HumanoidDescription)
end)

您应该等待角色加载到游戏中。 在应用 HumanoidDescription 之前。

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(character)
       wait()
       character:WaitForChild("Humanoid"):ApplyDescription(game.ServerStorage.HumanoidDescription)
    end)
end)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM