📜  Javascript: - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:13.804000             🧑  作者: Mango

代码示例2
local Manager = game:GetService("VirtualInputManager")
 
local Fol = Instance.new("Folder", game.Workspace)
Fol.Name = "Folder"
 
Fol.ChildAdded:connect(function(child)
if child.Value == "Money" then
wait()
child:Destroy()
 
game.ReplicatedStorage.Transactions.ClientToServer.Donate:InvokeServer(game.Players.LocalPlayer, game.Players.LocalPlayer.leaderstats.Money.Value, 1)
 
elseif child.Value == "Load" then
wait()
child:Destroy()
repeat
game.ReplicatedStorage.LoadSaveRequests.RequestLoad:InvokeServer(-1)
wait(1)
until game.Players.LocalPlayer.leaderstats.Money.Value == 20
game.ReplicatedStorage.LoadSaveRequests.RequestLoad:InvokeServer(game.Players.LocalPlayer.CurrentSaveSlot.Value)
elseif child.Value == "Save" then
wait()
child:Destroy()
game.ReplicatedStorage.LoadSaveRequests.RequestSave:InvokeServer(game.Players.LocalPlayer.CurrentSaveSlot.Value)
end
end)
 
function Call(VAL)
local String = Instance.new("StringValue")
String.Value = VAL
String.Parent = Fol
end
local CurrentMoney
 
function MoneyDupe(Times)
    for i = 1, Times do
        if game.Players.LocalPlayer.CurrentSaveSlot.Value ~= -1 then
            CurrentMoney = game.Players.LocalPlayer.leaderstats.Money.Value
            local DupeSlot = game.Players.LocalPlayer.CurrentSaveSlot.Value
            repeat
                Call("Money")
                wait(1)
            until game.Players.LocalPlayer.leaderstats.Money.Value == 0
            wait(59)
            Call("Load")
            repeat
                wait(0.1)
            until game:GetService("Players").LocalPlayer.PlayerGui.PropertyPurchasingGUI.SelectPurchase.Visible == true
                wait(1.2)
            Manager:SendKeyEvent(true,"E",false,game)
            repeat
                wait(0.1)
            until game:GetService("Players").LocalPlayer.PlayerGui.PropertyPurchasingGUI.ConfirmPurchase.Visible == true
            wait(0.5)
            Manager:SendKeyEvent(true,"E",false,game) 
            repeat
                wait(0.1)
            until game.Players.LocalPlayer.leaderstats.Money.Value > CurrentMoney
            for i = 1, 3 do
            Call("Save")
            wait(0.1)
            end
        end
    end
end
 
MoneyDupe(1)   sw