Script:
local DataStore = game:GetService("DataStoreService"):GetDataStore("PointsStorage")
game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new("IntValue", player)
stats.Name = "leaderstats"
--/////////////////////////////////////////////////////////////////////////////
local yo = Instance.new("IntValue", player.PlayerGui)
yo.Name = "Speed"
local yoo = Instance.new("IntValue", player.PlayerGui)
yoo.Name = "Health"
--/////////////////////////////////////////////////////////////////////////////
local Points = Instance.new("IntValue" , stats)
Points.Name = "Points"
local rk = Instance.new("IntValue" , stats)
rk.Name = "Rank"
local xp = Instance.new("IntValue" , stats)
xp.Name = "Experience"
local Key = "user-"..player.userId
local SavePoints = DataStore:GetAsync(Key)
if SavePoints then
Points.Value = SavePoints[1]
rk.Value = SavePoints[1]
xp.Value = SavePoints[1]
yo.Value = SavePoints[1]
yoo.Value = SavePoints[1]
else
local ValuesToSave = {Points.Value, rk.Value, xp.Value, yo.Value, yoo.Value}
DataStore:SetAsync(Key, ValuesToSave)
end
--level up system, kinda hacky--///////////////////////////////////////////////////////////////////////////
local StartLevelup=250
local Multiply= 1.5
xp.Changed:connect(function()
local Level=xp.Parent.Rank
if (Level ~=nil) and (xp.Value>= StartLevelup * Multiply) then -- Slow Rise in needed Exp
xp.Value = xp.Value-(StartLevelup * Multiply)
Level.Value = Level.Value + 1
Level.Parent.Parent.PlayerGui.ScreenGui.Frame.AgilityPlus.Speed.Value = Level.Parent.Parent.PlayerGui.ScreenGui.Frame.AgilityPlus.Speed.Value + 1
Level.Parent.Parent.PlayerGui.ScreenGui.Frame.JumpPowerPlus.JumpPower.Value = Level.Parent.Parent.PlayerGui.ScreenGui.Frame.JumpPowerPlus.JumpPower.Value + 1
Multiply=Multiply+.05
end
end)
--level up system, kinda hacky--///////////////////////////////////////////////////////////////////////////
end) |