local v = game.Players.LocalPlayer if v.Name == "Player1" or game:GetService("MarketplaceService"):PlayerOwnsAsset(v,440723046)==true then if v:FindFirstChild('leaderstats') then if v.leaderstats:FindFirstChild('XP') then v.leaderstats.XP.Changed:connect(function(z) v.leaderstats.XP.Value = v.leaderstats.XP.Value + 25 * workspace.Scripts.Multiplier.Value end) end end end
Because when i test i get 19:40:47.528 - Maximum event re-entrancy depth exceeded for IntValue.Changed 19:40:47.529 - While entering function defined in script 'Players.Player1.PlayerGui.DoubleXP', line 5
I'm going to suggest a Debounce
because I know no other way, but I'm sure there are more.
A debounce is a variable
used to stop code from running multiple times in a row. To add a debounce would make your code look somewhat like this,
local v = game.Players.LocalPlayer local Debounce = false if v.Name == "Player1" or game:GetService("MarketplaceService"):PlayerOwnsAsset(v,440723046)==true then if v:FindFirstChild('leaderstats') then if v.leaderstats:FindFirstChild('XP') then v.leaderstats.XP.Changed:connect(function(z) if Debounce then return end Debounce = true v.leaderstats.XP.Value = v.leaderstats.XP.Value + 25 * workspace.Scripts.Multiplier.Value wait(1)--Shouldn't have to wait long Debounce = false end) end end end
That was a short was of, hopefully, fixing your code.
I hope I helped.
Good Luck.