How do I endlessly increase the value of an integer?

Hello, I want to make an IntValue to increase endlessly, but when I try to, the IntValue doesn’t move up. Can anybody help me here?

I have tried adding the “boomboxadd” value (Is it a value?) and using parameters. (I am not good at scripting so I just tinkered with it)

local boombuxvalue = script.Parent.Parent:WaitForChild("leaderstats").BoomBux.Value


for boombuxadd = 1, math.huge do
   boombuxvalue = boombuxadd
   wait(1)
end

You are not linking the variable to the Value property as you think you are. You are just setting the variable to the Value of what it was at runtime.

Simply remove the .Value and when you need to read/write add .Value

local boombux = script.Parent.Parent:WaitForChild("leaderstats").BoomBux


while true do
    boombux.Value = boombux.Value + 1
    wait(1)
end

Also no need to reinvent the wheel :stuck_out_tongue:

1 Like

Well, I would do a while true loop (maybe).

local boombuxvalue = script.Parent.Parent:WaitForChild("leaderstats").BoomBux.Value

while true do
boombuxvalue.Value = boombuxvalue.Value + 1
   wait()
end
1 Like

I’d probably recommend using the run service over a while loop, and move this to the server. You don’t want exploiters to be able to edit their money.

local RunService = game:GetService("RunService")
local CheckTime = 1 -- how many seconds to wait between increases

local LastCheck = 0
RunService.Heartbeat:Connect(function()
    if os.time() - LastCheck < CheckTime then
        return
    end

    LastCheck = os.time()
    boombux.Value += 1
end)
3 Likes