What this is supposed to do is simple: When you click on the vending machine, a dollar gets cloned to the machine which then automatically gets put inside.
This has a 5 second cooldown each time.
There is no currency leaderboard of any type
What I get instead is this robloxapp-20210523-1655365.wmv (3.7 MB)
If you don't trust downloads or don't understand what's going on
I walk up to the vending machine and click on the spot where you insert money. Even though it places, there is no cooldown in-between placement and it does not enable it’s scripts (See below)
-
The folder “MoneyBox” will contain the cloned cash that is put inside.
-
The vending machine model is a child of Workspace
-
Hitboxes are only there because the main vending machine is mostly a union.
-
“Money” is a child of the vending machine.
-
It is the block that will be cloned to “MoneyBox”
-
It’s clone, “ClonedCash” will have these scripts enabled in-order to properly animate and destroy itself
The first script comes from the “InsertRobux” Forgive my multiple word usage such as money, cash, robux, etc. They all mean the same thing.
Explanation of what it's SUPPOSED to do (Stuff in bold means it is working as of now)
- The Boolean tells you that if it is true, the code can run on click.
- On click, that Boolean will automatically turn false meaning that any more clicks will do nothing.
- Money’s clone will: Be named ClonedCash, Have a new position of right infront of the machine, have it’s parent as Moneybox, and have it’s move and destroy script enabled.
- After 5 seconds, the Boolean will be true meaning the cooldown is over
local InsertBoolean = true
if InsertBoolean == true then
local function onClick()
print("Money has been inserted")
local InsertBoolean = false
local original = script.Parent.Parent.Parent.Money
local copycash = original:Clone()
copycash.Name = "ClonedCash"
copycash.Position = Vector3.new(14.13, 4.314, 19.449)
copycash.Parent = script.Parent.Parent.Parent.Moneybox
if copycash:FindFirstChild("Movescript")then
copycash.Movescript.Enabled = true
end
if copycash:FindFirstChild("DestroyScript")then
copycash.Destroyscript.Enabled = true
end
wait(5)
local InsertBoolean = true
print("Money is ready to be reinserted again")
end
script.parent.ClickDetector.MouseClick:Connect(onClick)
end
The second script comes from “Movescript”, a child of Money/ClonedCash
while true do
wait(1)
for i= 1, 200 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(1, 0, 0) --this part I can fix myself as it is most likely incorrect as well
wait()
end
wait(1)
for i= 1, 200 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(1, 0, 0)
wait()
end
end
The final script comes from “Destroyscript”, a child of Money/ClonedCash
wait(5)
script.Parent:Destroy()
Also keep in mind that even though I somewhat made all of this, I am not a very good scripter.