repeat task.wait() until game:isLoaded()
repeat task.wait() until game:GetService("Players")
repeat task.wait() until game:GetService("Players").LocalPlayer
repeat task.wait() until game:GetService("Players").LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
repeat task.wait() until game:GetService("Players").LocalPlayer.PlayerGui.Main.Enabled
repeat task.wait() until game:GetService("Workspace"):FindFirstChild('__MAP')

workspace.__THINGS.__REMOTES.MAIN:FireServer("b", "get my banks")
workspace.__THINGS.__REMOTES.MAIN:FireServer("b", "get bank")
workspace.__THINGS.__REMOTES.MAIN:FireServer("b", "bank deposit")
workspace.__THINGS.__REMOTES.MAIN:FireServer("b", "bank withdraw")
wait(1)

local GameLibrary = require(game:GetService("ReplicatedStorage"):WaitForChild("Framework"):WaitForChild("Library"))
local mybanks = game:GetService("Workspace")["__THINGS"]["__REMOTES"]:WaitForChild("get my banks"):InvokeServer({})
local MyBank = nil
for i,v in pairs(mybanks[1]) do
if v.Owner == game.Players.LocalPlayer.UserId then
    MyBank =v.BUID
end
end


local w = library:CreateWindow('Dickie')

w:Section('- - - - - -')

w:Section('Bank *****')
local b = w:Button("Withdraw 25B", function()

local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 25000000000 - GameLibrary.Save.Get().Diamonds
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank withdraw"):InvokeServer(unpack(args))

end)


local b = w:Button("Deposit 25B", function()

local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 25000000000
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank deposit"):InvokeServer(unpack(args))

end)

local b = w:Button("Desposit All", function()

local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = GameLibrary.Save.Get().Diamonds -- "Deposit" variable is now all your current diamonds
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank deposit"):InvokeServer(unpack(args))
end)

w:Section('Step 1')

local b = w:Button("In & Out", function()

local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 24900000000
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank withdraw"):InvokeServer(unpack(args))
wait(5)
local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 1000
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank deposit"):InvokeServer(unpack(args))
wait(5)
local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 1
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank withdraw"):InvokeServer(unpack(args))
end)

w:Section('***** *****')

local b = w:Button("The Magic", function()

local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 24900000000
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank withdraw"):InvokeServer(unpack(args))
wait(5)
local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 1000
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank deposit"):InvokeServer(unpack(args))
wait(5)
local args = {
    [1] = {
        [1] = MyBank,
        [2] = {},
        [3] = 1
    }
}

workspace.__THINGS.__REMOTES:FindFirstChild("bank withdraw"):InvokeServer(unpack(args))

wait(5)

for i=1, 150 do

wait(0.2)
coroutine.resume(coroutine.create(function()
    while true do
local function Bank(id)
   local self = {}
   function self:withdraw(pets, gems)
       workspace.__THINGS.__REMOTES["bank withdraw"]:InvokeServer({[1] = tostring(id), [2] = pets, [3] = tonumber(gems)})
   end
   function self:deposit(pets, gems)
       workspace.__THINGS.__REMOTES["bank deposit"]:InvokeServer({[1] = tostring(id), [2] = pets, [3] = tonumber(gems)})
   end
   return self
end
--//
local bankid = MyBank--bank id go here
for i=1, 10000 do
   Bank(bankid):withdraw({}, 1)
   print('withdrawed 1 gem')
   Bank(bankid):deposit({}, 1)
   print('deposited 1 gem')
   task.wait()
end
        wait()
    end

end))

end

end) 

Lua online compiler

Write, Run & Share Lua code online using OneCompiler's Lua online compiler for free. It's one of the robust, feature-rich online compilers for Lua language, running the latest Lua version 5.4. Getting started with the OneCompiler's Lua editor is easy and fast. The editor shows sample boilerplate code when you choose language as Lua and start coding.

Taking inputs (stdin)

OneCompiler's Lua online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Lua program which takes name as input and prints hello message with your name.

name = io.read("*a")
print ("Hello ", name)

About Lua

Lua is a light weight embeddable scripting language which is built on top of C. It is used in almost all kind of applications like games, web applications, mobile applications, image processing etc. It's a very powerful, fast, easy to learn, open-source scripting language.

Syntax help

Variables

  • By default all the variables declared are global variables
  • If the variables are explicitly mentioned as local then they are local variables.
  • Lua is a dynamically typed language and hence only the values will have types not the variables.

Examples

-- global variables
a = 10

-- local variables

local x = 30
Value TypeDescription
numberRepresents numbers
stringRepresents text
nilDifferentiates values whether it has data or not
booleanValue can be either true or false
functionRepresents a sub-routine
userdataRepresents arbitary C data
threadRepresents independent threads of execution.
tableCan hold any value except nil

Loops

1. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while(condition)
do
--code
end

2. Repeat-Until:

Repeat-Until is also used to iterate a set of statements based on a condition. It is very similar to Do-While, it is mostly used when you need to execute the statements atleast once.

repeat
   --code
until( condition )

3. For:

For loop is used to iterate a set of statements based on a condition.

for init,max/min value, increment
do
   --code
end

Functions

Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increase re-usuability and modularity.

optional_function_scope function function_name( argument1, argument2, argument3........, argumentn)
--code
return params with comma seperated
end