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 :)
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 :)
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".
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
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.
Check out this website: (https://www.alvinblox.com/) he does good scripting tutorials and would probably help you a lot