这段脚本出了问题

在我制作的游戏中有一个出售区域,这是脚本。我设置了一系列的打印语句来查看错误出现在哪里,它会在检查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)
点赞
用户11512564
用户11512564

Never mind the problem is in the tool that adds the clouds to the player, It is not updating the server.

别在意问题出在为玩家添加云的工具上,它没有更新服务器。

2020-05-03 22:08:04