【发布时间】:2022-02-23 21:42:48
【问题描述】:
我目前正在编写一个脚本,以便在触摸一个块时,玩家将进入位置。这是
game.Workspace.AUPortal.Glitch4.Position
我需要帮助解决这个错误。
Workspace.A12.MovePlayer:4:尝试使用“WaitForChild”索引 nil
脚本:
function onTouched(hit)
local h = hit.Parent:findFirstChild("Humanoid")
local playerMod = require(game:GetService("Players").LocalPlayer:WaitForChild("PlayerModule"))
local controls = playerMod:GetControls()
if h~=nil then
controls:Disable()
pos = game.Workspace.AUPortal.Glitch4.Position
h:MoveTo(pos)
wait()
end
end
script.Parent.Touched:connect(onTouched)
【问题讨论】: