Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua Roblox-和#x27;然后';预计接近';本地';_Lua_Roblox - Fatal编程技术网

Lua Roblox-和#x27;然后';预计接近';本地';

Lua Roblox-和#x27;然后';预计接近';本地';,lua,roblox,Lua,Roblox,我的Roblox脚本抛出了一个错误,我不知道为什么。这个错误意味着什么 它说第7行[7:0]“然后”预期接近“本地” local name = "" -- put the name of the lemonade / hotdog stand owner here local owner = game:GetService("Players")[name] for i,v in pairs(game.ReplicatedStorage.API:GetC

我的Roblox脚本抛出了一个错误,我不知道为什么。这个错误意味着什么

它说
第7行[7:0]“然后”预期接近“本地”

local name = "" -- put the name of the lemonade / hotdog stand owner here

local owner = game:GetService("Players")[name]

for i,v in pairs(game.ReplicatedStorage.API:GetChildren()) do
    if v:IsA("RemoteFunction")
        local A_1 = "lemonade_stand" -- change to hotdog_stand if its a hotdog stand
        local A_2 = owner
        v:InvokeServer(A_1, A_2)
    end

您需要将
then
添加为if-then,还需要另一个
end
来关闭
for
循环:

local name = "" -- put the name of the lemonade / hotdog stand owner here

local owner = game:GetService("Players")[name]

for i,v in pairs(game.ReplicatedStorage.API:GetChildren()) do
  if v:IsA("RemoteFunction") then
    local A_1 = "lemonade_stand" -- change to hotdog_stand if its a hotdog stand
    local A_2 = owner
    v:InvokeServer(A_1, A_2)
  end
end

此错误意味着您缺少生成运行脚本的要求

制定条件/声明时,必须始终将
置于条件之后。
为什么?将语法视为使脚本有意义的一种方式。
在循环结束时,您还缺少一个
结束
。别忘了

您的脚本已在下面修复。请记住,无论何时lua需要某些东西,都是语法错误

local Name=''
对于i,v成对(game.ReplicatedStorage.API:GetChildren())执行
如果v:IsA(“远程函数”),那么
v:InvokeServer('lemonade_stand',game.Players[Name])——或者您可以执行game.Players.LocalPlayer[PlayerName],这更简单。
终止
终止
您忘记在if v:IsA('RemoteEvent')之后添加“then”。 Lua中的条件语句总是这样开始的

local yourcondition = true

if yourcondition then
    print("yourcondition is true!")
end
这是一个愚蠢的错误,但是在这里输入你的问题之前,你应该先看看Roblox显示的错误。使用输出窗口可以很容易地解决这个问题。(查看->输出)语法就是这样工作的。把LUA翻译当作你的英语老师。你的老师会告诉你,如果你没有按照英语语法的要求去做,你就犯了一个错误