It only shows kills i need it to show exp to pls help.
local DS = game:GetService("DataStoreService")
local ExpStore = DS:GetOrderedDataStore("Exp")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local exp = Instance.new("IntValue", leaderstats)
exp.Name = "Exp"
pcall(function()
local ExpVal = ExpStore:GetAsync(player.UserId)
if ExpVal then
exp.Value = ExpVal
end
end)
game.ServerStorage.GiveExp.Event:Connect(function(amount,plr)
if player.Name == plr.Name then
exp.Value = exp.Value + amount
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
pcall(function()
if player:WaitForChild("leaderstats") and player.leaderstats:WaitForChild("Exp") and player.leaderstats.Exp.Value > 0 then
ExpStore:SetAsync(player.UserId, player.leaderstats.Exp.Value)
end
end)
end)
---------------------------------------------------------------
local datastore = game:GetService("DataStoreService")
local KillsStore = datastore:GetOrderedDataStore("Kills")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local Kills = Instance.new("IntValue", leaderstats)
Kills.Name = "Kills"
pcall(function()
local KillsVal = KillsStore:GetAsync(player.UserId)
if KillsVal then
Kills.Value = KillsVal
end
end)
game.ServerStorage.GiveKills.Event:Connect(function(amount,plr)
if player.Name == plr.Name then
Kills.Value = Kills.Value + amount
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
pcall(function()
if player:WaitForChild("leaderstats") and player.leaderstats:WaitForChild("Kills") and player.leaderstats.Kills.Value > 0 then
KillsStore:SetAsync(player.UserId, player.leaderstats.Kills.Value)
end
end)
end)

1 comment
first person to help get free sword on my game lol