So I'm working on a Bank robbery heist mission and I put a value of how many ATMs have been robbed. When the player touches/robs the ATM, I want the value to go up. I don't know how to make it go up. Here is the code.
function onTouch() script.Parent.Parent.Value.Value = -- ? end script.parent.Touched:connect(onTouch)
script.parent.Touched:connect(function(hit) script.Parent.Parent.Value.Value = script.Parent.Parent.Value.Value + 1 wait(0.5) end)
function onTouch() script.Parent.Parent.Value.Value = script.Parent.Parent.Value.Value + 1--Change 1 to anything you want end script.parent.Touched:connect(onTouch)
Including a debounce (if you want):
local Debounce = false script.Parent.Touched:Connect(function() if Debounce == true then return end Debounce = true script.Parent.Parent.Value.Value = script.Parent.Parent.Value.Value + 1 wait(0.5) Debounce = false end)