I made a leaderboard script. The script shows that if a player has 13500 XP, they would get 1 level. Same with if they got 27000-54000 they would get 1 level. But I'm having trouble with level.Value +1
. It keeps saying "= expected near +". I tried doing that but still a red underline. Any help please? Here is the script:
local Use_DB = true Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.XP level = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level function saveStat(plr,val,key) if plr then plr:WaitForDataReady() plr:SaveNumber(key,val) end end function loadStat(plr,key,stat) if plr then plr:WaitForDataReady() stat.Value = plr:LoadNumber(key,val) end end game.Players.PlayerAdded:connect(function(player) Stat = Instance.new("IntValue",player) Stat.Name = "leaderstats" Kills = Instance.new("IntValue",Stat) Kills.Name = "Level" if Use_DP then loadStat(player,"Level",Kills) end if Cash.Value>= 13500 then level.Value +1 if Cash.Value>= 27000 then level.Value +1 if Cash.Value>= 40500 then level.Value +1 if Cash.Value>= 54000 then level.Value +1 end end end end end)
Please get me a answer!
When creating a Leaderboard script always add a wait in the PlayerAdded function like so:
repeat wait() until player.Character
The way you changed the values of "Level" is wrong, it should be:
level.Value = level.Value + 1