while debounce == true do
wait(.50)
Character.RobbedCash.Value = Character.RobbedCash.Value + 500
repeat wait(1) until Character.RobbedCash.Value >= 1000
print('true')
debounce = false
end
end
end)
Every time he would have to edit the code if he wants to increase the maximum and he would have to edit all of his code but I find this as the solution
He can store the values as variables within the script then change them whenever he needs.
local Max1 = 1000
local Max2 = 1000
local ChosenMax
if thiscondition then
ChosenMax = Max1
elseif othercondition then
ChosenMax = Max2
end
for i = 0, ChosenMax, 500 do
wait(.5)
Character.RobbedCash.Value = Character.RobbedCash.Value + i
end
for X = 0,MaxCash,500 do
wait(.60)
if Character.RobbedCash.Value < MaxCash then
Character.RobbedCash.Value = Character.RobbedCash.Value + X
else
debounce = false
break
end
end
end
end)
Using this but for some reason, as soon as it hits 500, the value goes to 1500 instead of 1000 and then breaks.
local function updateCash()
for X = 0, MaxCash, 500 do
wait(0.5)
Character.RobbedCash.Value = Character.RobbedCash.Value + X
debounce = false
end
end
updateCash()
end
end)
local function updateCash(MaxCash)
for X = 0, MaxCash, 500 do
wait(.5)
Character.RobbedCash.Value = Character.RobbedCash.Value + X
end
end
updateCash(1000)
end
end)
Why are you calling the function again? Imagine you got a task, cut onions. You get a piece of paper with instructions. Paper reads:
-Cut onions
-Start the task again
Now you are stuck cutting onions for all eternity.
Then. It should work. Unless…:
You haven’t called the function
or
You haven’t used my script
or
The “RobbedCash” Value doesn’t exist (but this would return an error so rule this one out)
Reading over it again, The “Character” Value isn’t defined either.
function UpdateCash(MaxCash, Character)
for i = 0, MaxCash, 500 do
wait(.5)
Character.RobbedCash.Value = Character.RobbedCash.Value + i
end
end
UpdateCash(1000, Char)