Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Why does Studio skip 7 and adds 8000 by their self?

Asked by 4 years ago
Edited 4 years ago
if script.Parent.Parent.LoadingDone.Value == false then
        while true do
            if current < player.leaderstats.Levels.Value * 1000 then break end
            current = current - (player.leaderstats.Levels.Value * 1000)
            print(current)
            player.leaderstats.Levels.Value = player.leaderstats.Levels.Value + 1
            print(player.leaderstats.Levels.Value)
            wait()
        end
        levelexp = current
        current = player.Exp.Value
        script.Parent.Parent.LoadingDone.Value = true
        level = player.leaderstats.Levels.Value
        lead_level = player.leaderstats.Levels
    end

This is a part of my code. So let's say we have 15000 exps. (When first joining the game) we will load the exp to levels. In Level 1 you need 1000 on lv 2 you need 2000 etc. like that well I'm not very used to repeat ~ until, so I replaced it with a while statement. I will tell you the outputs

14487 -- Exp
  2 -- Level
 12487 --Exp
  3 -- Level
  9487
  4
  5487
  5
  487
  6
  8487
  8
  487
  9

well, you can't do 487 -(6*1000), so I thought it will stopover here, but instead, Lv7 disappeared and the exps became 8487 and straight went to Lv9. Why did studio do this?

0
Or Should I make another datasave 'Levels'' tree_tree00 48 — 4y
0
Would you mind inviting me to your studio for team create, as I just tested this out on my own and it worked fine. BuDeep 214 — 4y
0
What code have you used? tree_tree00 48 — 4y

Answer this question