【发布时间】:2019-06-27 10:57:54
【问题描述】:
我正在尝试编写一个脚本,在玩家触摸门时搜索他们的背包,这样它就可以判断玩家是否有钥匙卡。如果玩家有钥匙卡,它应该说“是”,但由于某种原因,它一直报错。这是我的代码:
function onTouched(m)
p = m.Parent:findFirstChild("Humanoid")
if p ~= nil then
n = p.parent
local letin = game.Players(n).Backpack:FindFirstChild("Key Card")
if letin then
print("Yes")
else
print("No")
end
end
end
script.Parent.Touched:connect(onTouched)
错误是:
Trying to call method on object of type: 'Player' with incorrect arguments.
有谁知道为什么这可能不起作用?
【问题讨论】:
-
错误是什么?
-
它说:试图调用类型对象的方法:'Player' 参数不正确。
标签: roblox