【问题标题】:What is wrong with this script这个脚本有什么问题
【发布时间】:2020-05-04 06:08:04
【问题描述】:

在我正在制作的游戏中,有一个销售区域,这就是脚本。我设置了一系列打印语句来查看错误发生在哪里,并且在检查Clouds.Value时发生,您能帮我修复脚本吗,我不知道导致错误的原因。

local Players = game:GetService("Players")

script.Parent.Touched:Connect(function(hit)
    print(hit.Name)
    if game.Players:FindFirstChild(hit.Parent.Name) then
        print("Found")
        local plr = Players:GetPlayerFromCharacter(hit.Parent)
        local stats = plr:FindFirstChild("leaderstats")
        if stats then
        print("Working")
            local Cash = stats:FindFirstChild("CloudCoins")
            print("Cash")
            local Clouds = stats:FindFirstChild("Clouds")
            print("Clouds")
            if Clouds.Value > 0 then
                print("Value")
                Cash.Value = Cash.Value + Clouds.Value
                Clouds.Value = 0
            else
                print("Error")
            end
        end
    end
end)

【问题讨论】:

    标签: lua roblox


    【解决方案1】:

    没关系,问题出在将云添加到播放器的工具中,它没有更新服务器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-27
      • 2015-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-11
      相关资源
      最近更新 更多