脚本正在运行,但根本没有按照它所说的去做(没有错误)

问题描述 投票:0回答:1

我正在制作一款模拟器类型的游戏,当你走到某个部分时,你可以出售你的东西。我已经编写了代码来拿走你的东西,但无论我做什么,它都不会做任何事情。 该代码将统计数据设置为零,但它实际上并没有在游戏中发生。令人费解的是,输出没有错误

local hitbox = game.Workspace.SellBuildingHitbox

hitbox.Touched:Connect(function(hit)
    
    local plrname = hit.Parent.Name

    if game.Players:FindFirstChild(plrname) then
        
        local plr = game.Players:FindFirstChild(plrname)
        
        plr.Stats.Stomach.Value = 0 
        
        
    end

end)

提前致谢!

lua roblox luau roblox-studio
1个回答
0
投票
  1. 如果变量位于 TAB 菜单中,则
    Stats
    应该命名为
    leaderstats
  2. 如果变量是 Gui,则更改 gui 中的文本
© www.soinside.com 2019 - 2024. All rights reserved.