Oh I see what you have done. You have set only one data store for 3 values. This just overwrites the before variables, so in the end, you only save the data: Toonys.
Here is a solution:
01 | local datastore = game:GetService( "DataStoreService" ) |
02 | local Exp = datastore:GetDataStore( "Exp" ) |
03 | local Toony = datastore:GetDataStore( "Toony" ) |
04 | local Level = datastore:GetDataStore( "Level " ) |
08 | game.Players.PlayerAdded:Connect( function (player) |
10 | playersleft = playersleft + 1 |
12 | local leaderstats = Instance.new( "Folder" ,player) |
14 | leaderstats.Name = "leaderstats" |
16 | local exp = Instance.new( "IntValue" ,leaderstats) |
20 | local maxexp = Instance.new( "IntValue" ,leaderstats) |
22 | maxexp.Name = "MaxExp" |
26 | local level = Instance.new( "IntValue" ,leaderstats) |
30 | local toonys = Instance.new( "IntValue" ,leaderstats) |
32 | toonys.Name = "Toonys" |
34 | if level.Value = = level.Value + 1 then |
36 | maxexp.Value = maxexp.Value * 2 |
49 | exp_data = Exp:GetAsync(player.UserId.. " Exp" ) |
51 | level_data = Level:GetAsync(player.UserId.. " Level" ) |
53 | toony_data = Toony:GetAsync(player.UserId.. "Toonys" ) |
57 | if toony_data ~ = nil and level_data ~ = nil and exp_data ~ = nil then |
59 | toonys.Value = toony_data |
63 | level.Value = level_data |
77 | game.Players.PlayerRemoving:Connect( function (player) |
81 | playersleft = playersleft - 1 |
83 | Exp:SetAsync(player.UserId.. " Exp" ,player.leaderstats.Exp.Value) |
85 | Level:SetAsync(player.UserId.. " Level" ,player.leaderstats.Level.Value) |
87 | Toony:SetAsync(player.UserId.. " Toonys" ,player.leaderstats.Toonys.Value) |
Hope this helped!