There are no errors, and it wont work. Can someone help? I put it in my leaderstats script, heres the full script:
local ds = game:GetService("DataStoreService")
local ds1 = ds:GetDataStore("GoldSaveSystem")
local ds2 = ds:GetDataStore("ExperienceSaveSystem")
local ds3 = ds:GetDataStore("LevelSaveSystem")
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder", player)
folder.Name = "leaderstats"
local Gold = Instance.new("IntValue", folder)
Gold.Name = "Gold"
local Experience = Instance.new("IntValue", folder)
Experience.Name = "Experience"
local Level = Instance.new("IntValue", folder)
Level.Name = "Level"
Gold.Value = ds1:GetAsync(player.UserId) or 0
ds1:GetAsync(player.UserId, Gold.Value)
Experience.Value = ds2:GetAsync(player.UserId) or 0
ds2:GetAsync(player.UserId, Experience.Value)
Level.Value = ds3:GetAsync(player.UserId) or 1
ds3:GetAsync(player.UserId, Level.Value)
player.CharacterAdded:Connect(function(character)
character.Humanoid.MaxHealth = 100 * (Level.Value +1)
character.Humanoid.Health = player.Character.MaxHealth
end)
Experience.Changed:Connect(function()
if Experience.Value >= 100 * (Level.Value +1) then
Experience.Value = 0
Level.Value = Level.Value +1
end
end)
Level.Changed:Connect(function()
player.Character.Humanoid.MaxHealth = 100 * (Level.Value)
player.Character.Humanoid.Health = 100 * (Level.Value)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
local Gold = player.leaderstats.Gold
local Experience = player.leaderstats.Experience
local Level = player.leaderstats.Level
ds1:SetAsync(player.UserId, Gold.Value)
ds2:SetAsync(player.UserId, Experience.Value)
ds3:SetAsync(player.UserId, Level.Value)
end)
And heres the part that wont work
player.CharacterAdded:Connect(function(character)
character.Humanoid.MaxHealth = 100 * (Level.Value +1)
character.Humanoid.Health = player.Character.MaxHealth
end)

1 comment
I did. I turned HTTPS and API on.