I need Help support My Game-Pass x2 System script

Hello, I wanted to know how I can solve this problem with my game pass, I’ve been playing my game and I realized that this code appeared:

Maximum event re-entrancy depth exceeded for IntValue.Changed (x2) 

And this is my game pass:

local MS = game:GetService(“MarketplaceService”)
local VIPID = 9725804

local RS = game:GetService(“ReplicatedStorage”)

game.Players.PlayerAdded:Connect(function(plr)
if MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then
local Training = game.ServerStorage:WaitForChild(“Training2x”)

	plr:WaitForChild("Stats"):WaitForChild("Strength").Changed:Connect(function()
		plr.Stats.Strength.Value = plr.Stats.Strength.Value + Training.Value + Training.Value / 2* plr.leaderstats.Rebirth.Value

	end)
end
end)

How can I solve this problem? Thanks.

You’re calling this event way too many times, which is resulting in an endless loop of Event detecting the value changes

Basically, think of it like this:

Event detects the Value Change > Value Changes > Repeat

If you remove that .Changed event, you should be fine

If I use “debounce” could it help with anything?

I believe it could be possible to use a debounce, try this:

local MS = game:GetService("MarketplaceService")
local VIPID = 9725804

local RS = game:GetService("ReplicatedStorage")

game.Players.PlayerAdded:Connect(function(plr)
	if MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then
		local Training = game.ServerStorage:WaitForChild("Training2x")
		
		local DB = false
		plr:WaitForChild("Stats"):WaitForChild("Strength").Changed:Connect(function()
			
			if not DB then
				DB = true
				plr.Stats.Strength.Value = plr.Stats.Strength.Value + Training.Value + Training.Value / 2* plr.leaderstats.Rebirth.Value
				
				DB = false
			end
		end)
		
	end
end)

It doesn’t solve a lot of things, I will check in videos or in other things that I can solve better. Thanks you.