Lua “我一直在犯错误。”;论点1缺失或无;而且它不';i don’我不能给我一个行号,所以我不知道该怎么办

Lua “我一直在犯错误。”;论点1缺失或无;而且它不';i don’我不能给我一个行号,所以我不知道该怎么办,lua,roblox,Lua,Roblox,脚本试图使用点击检测器将玩家从主游戏传送到另一个地方:GetPlayFromCharacter需要一个角色(顾名思义)。你没有给它任何理由 然而,这是没有必要的MouseClick为您提供单击ClickDetector的播放器: local TeleportService = game:GetService("TeleportService") local Place = 1639914227 script.Parent.MouseClick:Connect(function() lo

脚本试图使用点击检测器将玩家从主游戏传送到另一个地方

:GetPlayFromCharacter
需要一个角色(顾名思义)。你没有给它任何理由

然而,这是没有必要的
MouseClick
为您提供单击ClickDetector的播放器:

local TeleportService = game:GetService("TeleportService") 
local Place = 1639914227
script.Parent.MouseClick:Connect(function()
    local player = game.Players:GetPlayerFromCharacter()
    if player then
        TeleportService:Teleport(Place, player)
    end
end)

我怀疑这个特定的错误是否没有行号——它应该紧跟在错误之后,如中所示

23:45:22.359-参数1缺失或为零

23:45:22.360-堆栈开始

23:45:22.361-脚本“Workspace.Part.ClickDetector.Script”,第4行

23:45:22.362-堆栈结束

script.Parent.MouseClick:Connect(function(player)
    TeleportService:Teleport(Place, player)
end)