I have done the leader boards already
local level = 1 local exp = 0 local axp = 20 local InStudio = game:GetService("RunService"):IsStudio() if not InStudio then level = game:GetService("DataStoreService"):GetDataStore("Levels") exp = game:GetService("DataStoreService"):GetDataStore("EXP") axp = game:GetService("DataStoreService"):GetDataStore("AXP") -- Amount of exp needed to level up. end function savedata(dataname, playerid, value) if InStudio then return end dataname:SetAsync(playerid, value) end game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder") leader.Name = "leaderstats" leader.Parent = player local levelz = Instance.new("IntValue") levelz.Name = "Level" local xpz = Instance.new("NumberValue") xpz.Name = "Exp" local xpn = Instance.new("IntValue") xpn.Name = "ExpNeeded" if not InStudio then xpn.Value = axp:GetAsync(tostring(player.userId)) or 20 xpz.Value = exp:GetAsync(tostring(player.userId)) or 0 levelz.Value = level:GetAsync(tostring(player.userId)) or 1 else xpn.Value = axp xpz.Value = exp levelz.Value = level end levelz.Parent = leader xpz.Parent = leader xpn.Parent = leader xpz.Changed:connect(function() if player.leaderstats:WaitForChild("Exp").Value >= player.leaderstats:WaitForChild("ExpNeeded").Value then levelz.Value = levelz.Value + 1 xpn.Value = math.floor(xpn.Value * 2) --You can change this if you want. xpz.Value = 0 savedata(level, player.userId, levelz.Value) savedata(exp, player.userId, xpz.Value) savedata(axp, player.userId, xpn.Value) else savedata(level, player.userId, levelz.Value) savedata(exp, player.userId, xpz.Value) savedata(axp, player.userId, xpn.Value) end savedata(level, player.userId, levelz.Value) savedata(exp, player.userId, xpz.Value) savedata(axp, player.userId, xpn.Value) end) end) game.Players.PlayerRemoving:connect(function(player) savedata(level, player.userId, player.leaderstats.Level.Value) savedata(exp, player.userId, player.leaderstats.Exp.Value) savedata(axp, player.userId, player.leaderstats.ExpNeeded.Value) end) --Animation Script (Local Script) local player = game.Players.LocalPlayer local exp = player:WaitForChild("leaderstats"):WaitForChild("Exp") local axp = player:WaitForChild("leaderstats"):WaitForChild("ExpNeeded") while true do wait() local expBarSize = (exp.Value/axp.Value) - 0.02 if exp.Value == 0 then expBarSize = 0 script.Parent:TweenSize(UDim2.new(expBarSize, 0, 0, 20), "Out", "Quad", 0.25) else script.Parent:TweenSize(UDim2.new(expBarSize, 0, 0, 20), "Out", "Quad", 0.25) end end --ExpText Script (Local Script) local player = game.Players.LocalPlayer local exp = player:WaitForChild("leaderstats"):WaitForChild("Exp") local axp = player:WaitForChild("leaderstats"):WaitForChild("ExpNeeded") while true do wait() script.Parent.Text = "EXP: " .. exp.Value .. "/" .. axp.Value end --GetLevel Script (Local Script) local player = game.Players.LocalPlayer local level = player:WaitForChild("leaderstats"):WaitForChild("Level") script.Parent.Text = "Current Level: " .. level.Value level.Changed:Connect(function(value) script.Parent.Text = "Current Level: " .. value end) --GiveExp Script (Server Script) local PlayersService = game:GetService("Players") local function onTouch(hit) local player = PlayersService:GetPlayerFromCharacter(hit.Parent) local expPoints = player:findFirstChild("leaderstats") if expPoints ~= nil then local points = expPoints:findFirstChild("Exp") if points ~= nil then points.Value = points.Value + 5 end end end script.Parent.Touched:connect(onTouch)
i want wooden dummy to give the amount of exp when died (like in rpg game :D)