Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an ATM? Help please {Read description}

Asked by 6 years ago

I need help with an ATM that gives money when touched by a credit card, I already have the ATM and the credit card I just need the script

Help please, im a new developer with big dreams :)

0
I suggest you look more into scripting tutorials before starting to make a game. A game will consist of thousands and thousands of lines of code. If you want to be successful, then you either better learn to script or hire a scripter. Axceed_Xlr 380 — 6y
0
Check out this website: (https://www.alvinblox.com/) he does good scripting tutorials and would probably help you a lot EnderGamer358 79 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Based on your question, you want money awarded to player if the player touches the atm with the creditcard. There are many way I can think of making this work, but here's 1 of the way:

ATM = script.Parent
debounce = false    --> Prevents spamming of card touching ATM
ATM.Touched:connect(function(entity)
    if entity.Parent.Name == "Card" and debounce == false then
        debounce = true
        --Add money to the player's wallet, assuming wallet is an existing "IntValue" inside all your player (Put it inside of StarterPack)
        PlayerChar =  entity.Parent.Parent
        player = game.Players:GetPlayerFromCharacter(PlayerChar)
        PlayerWallet = player.Backpack:FindFirstChild("Wallet")
        PlayerWallet.Value = PlayerWallet.Value + 100 --> Player Wallet increases by 100 everytime card touches atm.
        print(PlayerWallet.Value) --> printing your result to the output
        wait(1)                   --> Time frame (in secs) before Card can touch the ATM again 
        debounce = false
    end
end)

Since you didnt state where you've stored or want to store your money, I've assumed that you stored it in a "IntValue" named "Wallet".

0
This answer looks pretty good, but I saw something that I don't understand at all, why does it say "Player wallet = Player.Backpack.Wallet" I mean, why backpack? I thought you stored gear there TheNewLordOfLand 2 — 6y
Ad

Answer this question