Hello, I have since two days this problem. I don't why I have it now on every game of my with this system but okay. So when you enters a exp value in like 15000 your rank have to change what works put then that error start and my xp jumps out of the bar I know its the leaderboard causing it.
This works fine but just incause its needed.
wait(2)
while true do
wait()
local player = game.Players.LocalPlayer
local xp = player.leaderstatslevel.Exp.Value
local maxlvl = player.leaderstatslevel.Rank.Value * 100
local mats = (xp/maxlvl)
script.Parent:TweenSize(UDim2.new(mats,0,1,0),'Out','Quad',10)
end
Error: Maximum event re-entrancy depth exceeded for IntValue.Changed error I know the meaning to many events at once.. I am thinking maybe the problem is at line 14 or 24 but the game tells me line 65.
game.ServerScriptService:WaitForChild("PlayerDataStore") -- works fine
local PDSM = require(game.ServerScriptService.PlayerDataStore)
local MaxLevel = 250
local ResetTo1 = false
local LevelName = "Rank" -- Level
local ExpName = "Exp" -- XP
function Save(Player,SaveName,Value)
local Data = PDSM:GetSaveData(Player)
Data:Set(SaveName,Value)
end
function Load(Player,SaveName)
local Data = PDSM:GetSaveData(Player)
local Number = Data:Get(SaveName)
if SaveName == "Ranks" then
return (Number or 1)
else
return (Number or 0)
end
end
function LevelChange(PlayerIns,Stat)
if Stat.Value >= MaxLevel then
if PlayerIns.userId ~= game.CreatorId then
if ResetTo1 == true then
Stat.Value = 1
else
Stat.Value = MaxLevel
end
end
end
Save(PlayerIns,"Rank",Stat.Value)
end
function ExpChange(PlayerIns,Stat,LevelStat)
if LevelStat.Value < MaxLevel then
if Stat.Value >= LevelStat.Value*100 then
Stat.Value = Stat.Value - (LevelStat.Value*100)
LevelStat.Value = LevelStat.Value + 1
end
end
Save(PlayerIns,"Exp",Stat.Value)
end
game.Players.PlayerAdded:connect(function(Player)
wait()
local Holder = Instance.new("IntValue")
Holder.Name = "leaderstatslevel"
Holder.Parent = Player
local Stat1 = Instance.new("IntValue")
Stat1.Name = LevelName
Stat1.Parent = Holder
local Stat2 = Instance.new("IntValue")
Stat2.Name = ExpName
Stat2.Parent = Holder
Stat1.Value = Load(Player,"Rank")
Stat2.Value = Load(Player,"Exp")
Stat1.Changed:connect(function() LevelChange(Player,Stat1) end)
Stat2.Changed:connect(function() ExpChange(Player,Stat2,Stat1) end)
end)
game.OnClose = function()
PDSM:FlushAll()
wait(5)
end
Thanks I don't know how to fix this issue pretty big..
