0

一些简单的代码

script.Parent.MouseButton1Up:connect(function()
    ????.leaderstats.lvl.Value = 0
    ????.leaderstats.xp.Value = 0
    ????.leaderstats.gold.Value = 0

它甚至不工作。所以玩家点击了 gui,但是如何重置玩家的leaderstats,特别是 lvl、xp 和金币,我现在运行一个相当流行的 roblox rpg 游戏,大约有 400 人,这将是一个巨大的帮助。

4

2 回答 2

1

您可以将以下代码放在按钮内的LocalScript中。

    Player = game.Players.LocalPlayer --Only works inside a localscript, replace with the line below it if you need it as a Script.
    -- Player=script.Parent while (not Player:IsA("Player")) do Player = Player.Parent end

    script.Parent.MouseButton1Up:connect(function()
        local index, stat
        for index, stat in pairs(Player.leaderstats:GetChildren()) do
            stat.Value = 0
        end
    end)
于 2013-12-06T17:01:37.420 回答
0

它应该在 LocalScript 中,因此您可以使用 LocalPlayer 变量来获取 leaderstats 并设置它们。

于 2017-08-31T14:10:24.473 回答