用户:
145a查看:21 回复:10 评论:21 创建时间:2022-08-09T19:01:46
TypeError: entity.player.wearables is not a function
报错处源代码
world.onPress(async ({ button,entity }) => {
if(button == "crouch")
entity.textDialog(undefined,entity.player.wearables());
});
SCS_user_LoeheodVOQworld.onPress(async ({ button,entity }) => {
if(button == "crouch")
entity.textDialog(undefined,entity.player.wearables);
});
试试?
点赞0
评论
SCS_user_LoeheodVOQworld.onPress(async ({ button, entity }) => {
if (button == "crouch"){
console.log(JSON.stringify(entity.player.wearables()));
};
});
是可以的啊
点赞1
评论
为啥你在代码截图里没有导入entity这个参数,一般这个报错是在entity不是玩家的时候触发的,你最好在onPress里在导入一个entity,还有你到底在外面套了个啥,world.onPress是不需要在玩家触发的代码里写的,直接写在最外层就好了,如果你是要搞玩家的区别对待的话,你在onpress里用entity进行判定,而且onpress只能是玩家触发的,所以你不要有顾虑。
点赞0
评论