Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PointsStore = game:GetService("DataStoreService"):GetDataStore("Points")
- LevelStore = game:GetService("DataStoreService"):GetDataStore("Level")
- XpStore = game:GetService("DataStoreService"):GetDataStore("Xp")
- PlayedStore = game:GetService("DataStoreService"):GetDataStore("Games played")
- WonStore = game:GetService("DataStoreService"):GetDataStore("Games won")
- LostStore = game:GetService("DataStoreService"):GetDataStore("Games lost")
- function onxpchanged(player, level, xp)
- if xp.Value >= level.Value * 125 then
- xp.Value = xp.Value - level.Value * 125
- level.Value = level.Value + 1
- end
- end
- function onlevelchanged(player, level)
- for i, v in pairs(player.PlayerGui.ScreenGui.UpdFrame:GetChildren()) do
- v:Destroy()
- end
- local note = script.TextLabel
- local noteclone = note:Clone()
- noteclone.Text = "Level " .. level.Value .. " achieved!"
- noteclone.Parent = player.PlayerGui.ScreenGui.UpdFrame
- for i = 1, 0, -0.05 do
- noteclone.TextStrokeTransparency = i
- noteclone.TextTransparency = i
- wait()
- end
- wait(1.5)
- for i = 0, 1, 0.05 do
- noteclone.TextStrokeTransparency = i
- noteclone.TextTransparency = i
- wait()
- end
- noteclone:Destroy()
- end
- game.Players.PlayerAdded:connect(function(player)
- player:WaitForDataReady()
- local stats = Instance.new("IntValue", player)
- stats.Name = "leaderstats"
- local points = Instance.new("IntValue", stats)
- points.Name = "Points"
- local otherstats = Instance.new("IntValue", player)
- otherstats.Name = "localstats"
- local level = Instance.new("IntValue", otherstats)
- level.Name = "Level"
- local xp = Instance.new("IntValue", otherstats)
- xp.Name = "Xp"
- local ingame = Instance.new("BoolValue", player)
- ingame.Name = "Ingame"
- ingame.Value = false
- local isplaying = Instance.new("BoolValue", player)
- isplaying.Name = "Isplaying"
- isplaying.Value = true
- local personalstats = Instance.new("IntValue", player)
- personalstats.Name = "personalstats"
- local gplayed = Instance.new("IntValue", personalstats)
- gplayed.Name = "Games played"
- local gwon = Instance.new("IntValue", personalstats)
- gwon.Name = "Games won"
- local glost = Instance.new("IntValue", personalstats)
- glost.Name = "Games lost"
- if PointsStore:GetAsync(player.Name) ~= nil then
- points.Value = PointsStore:GetAsync(player.Name)
- else
- points.Value = 0
- end
- if LevelStore:GetAsync(player.Name) ~= nil then
- level.Value = LevelStore:GetAsync(player.Name)
- else
- level.Value = 1
- end
- if XpStore:GetAsync(player.Name) ~= nil then
- xp.Value = XpStore:GetAsync(player.Name)
- else
- xp.Value = 0
- end
- if PlayedStore:GetAsync(player.Name) ~= nil then
- gplayed.Value = PlayedStore:GetAsync(player.Name)
- else
- gplayed.Value = 0
- end
- if WonStore:GetAsync(player.Name) ~= nil then
- gwon.Value = WonStore:GetAsync(player.Name)
- else
- gwon.Value = 0
- end
- if LostStore:GetAsync(player.Name) ~= nil then
- glost.Value = LostStore:GetAsync(player.Name)
- else
- glost.Value = 0
- end
- points.Changed:connect(function(update)
- PointsStore:SetAsync(player.Name, update)
- end)
- level.Changed:connect(function(update)
- LevelStore:SetAsync(player.Name, update)
- onlevelchanged(player, level)
- end)
- xp.Changed:connect(function(update)
- XpStore:SetAsync(player.Name, update)
- onxpchanged(player, level, xp)
- end)
- gplayed.Changed:connect(function(update)
- PlayedStore:SetAsync(player.Name, update)
- end)
- gwon.Changed:connect(function(update)
- WonStore:SetAsync(player.Name, update)
- end)
- glost.Changed:connect(function(update)
- LostStore:SetAsync(player.Name, update)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement