So im trying to fire this function and its not working, whenever the exp is higher than needed it does nothing in this function. It is suppose to put their exp vale to 0 after it is higher than needed.
local function updateEXP(exp)
print(expValue.Value)
print(expToLevel.Value)
if exp >= expToLevelUp(LevelStore:Get(defaultLevel)) then
ExpStore:Increment(expToLevelUp(LevelStore:Get(defaultLevel)) * -1)
LevelStore:Increment(1)
game.Workspace["Level Up"]:Play()
player.leaderstats.Exp.Value = 0
game.StarterGui.Level.LevelUP.Visible = true
wait(1)
game.StarterGui.Level.LevelUP.Visible = false
else
player.leaderstats.Exp.Value = exp
end
local expAtNextLevel = expToLevelUp(LevelStore:Get(defaultLevel))
local currentlyHave = ExpStore:Get(defaultexp)
player.leaderstats.ExpToLevel.Value = expAtNextLevel - currentlyHave
end
replicatedStorage.Events.UpdateExp.OnServerEvent:Connect(function(plr, exp)
print("Called")
updateEXP(exp)
I just noticed you’re changing the StarterGui instead of changing the PlayerGui, the player actually sees what’s inside the PlayerGui so you should be changing that instead. (StarterGui gets replicated to the PlayerGui but you shouldn’t be changing the StarterGui)