How to make it continuously add?

I know this is a dumb question but, I want to make this continuously add.

--[[Services]]

local MPS = game:GetService("MarketplaceService")
local RS = game:GetService("ReplicatedStorage")
local player = game:GetService("Players")

player.PlayerAdded:Connect(function(plr)
	
	local ls = plr:WaitForChild("leaderstats")
	local MP = plr:WaitForChild("MP")
	
	local BallorasPerSec = coroutine.create(function()
		ls.Balloras.Value += 1
	end)
	
	while task.wait(1) do
		coroutine.resume(BallorasPerSec)
	end
	
end)

I think you just have the order slightly wrong, the while task.wait(1) do is resuming the coroutine, which is over the first time you start it. If you rearrange it like this, I believe this would solve your problem

player.PlayerAdded:Connect(function(plr)
	
	local ls = plr:WaitForChild("leaderstats")
	local MP = plr:WaitForChild("MP")
	
	local BallorasPerSec = coroutine.create(function()
	        while task.wait(1) do
		        ls.Balloras.Value += 1
            end
	end)
	
    coroutine.resume(BallorasPerSec)
	
end)

Omg thank you! It works perfectly fine

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.