i have a problem with the points script i made can anyone help??
ok so thi is the script
05 | local InStudio = game:GetService( "RunService" ):IsStudio() |
08 | level = game:GetService( "DataStoreService" ):GetDataStore( "Levels" ) |
09 | exp = game:GetService( "DataStoreService" ):GetDataStore( "EXP" ) |
10 | axp = game:GetService( "DataStoreService" ):GetDataStore( "AXP" ) |
13 | function savedata(dataname, playerid, value) |
14 | if InStudio then return end |
15 | dataname:SetAsync(playerid, value) |
18 | game.Players.PlayerAdded:Connect( function (plr) |
19 | local Strength = Instance.new( "IntValue" ) |
20 | Strength.Name = "Strength" |
23 | local pts = Instance.new( "IntValue" ) |
27 | local levelz = Instance.new( "IntValue" ) |
30 | local xpz = Instance.new( "NumberValue" ) |
31 | xpz.Name = "Experience" |
33 | local xpn = Instance.new( "IntValue" ) |
34 | xpn.Name = "ExpNeeded" |
38 | xpn.Value = axp:GetAsync( tostring (plr.UserId)) or 375 |
39 | xpz.Value = exp:GetAsync( tostring (plr.UserId)) or 0 |
40 | levelz.Value = level:GetAsync( tostring (plr.UserId)) or 1 |
47 | xpz.Changed:Connect( function () |
48 | if plr:WaitForChild( "Experience" ).Value > = plr:WaitForChild( "ExpNeeded" ).Value then |
49 | levelz.Value = levelz.Value + 1 |
50 | xpn.Value = math.floor(xpn.Value * 2 ) |
52 | pts.Value = pts.Value + 2 / 2 |
54 | savedata(level, plr.UserId, levelz.Value) |
55 | savedata(exp, plr.UserId, xpz.Value) |
56 | savedata(axp, plr.UserId, xpn.Value) |
58 | savedata(level, plr.UserId, levelz.Value) |
59 | savedata(exp, plr.UserId, xpz.Value) |
60 | savedata(axp, plr.UserId, xpn.Value) |
62 | savedata(level, plr.UserId, levelz.Value) |
63 | savedata(exp, plr.UserId, xpz.Value) |
64 | savedata(axp, plr.UserId, xpn.Value) |
68 | game.Players.PlayerRemoving:Connect( function (plr) |
69 | savedata(level, plr.UserId, plr.Level.Value) |
70 | savedata(exp, plr.UserId, plr.Experience.Value) |
71 | savedata(axp, plr.UserId, plr.ExpNeeded.Value) |
and the problem is that the points you get when you level up the "points" get added to the starting value of the Points
something like this lvl 1 = 2 pts (because the player starts with this)
lvl 2 = 4 pts (and thats what i meant)
the pts or points is an IntValue