Hello! I'm using a folder with values. They are going to be stored in the database after, but I have a problem. Even tho I set the values to 1 when I define them, if I run the game and look in explorer, their value is 0. This is what I tried:
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataScore")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local ab_folder = Instance.new("Folder")
ab_folder.Name = "abilities"
ab_folder.Parent = player
local points_lvl = Instance.new("IntValue")
points_lvl.Name = "pointsbonus"
**points_lvl.Value = 1**
points_lvl.Parent = ab_folder
local health_lvl = Instance.new("IntValue")
health_lvl.Name = "health"
**health_lvl.Value = 1**
health_lvl.Parent = ab_folder
local agility_lvl = Instance.new("IntValue")
agility_lvl.Name = "agility"
**agility_lvl.Value = 1**
agility_lvl.Parent = ab_folder
local saved_points_level
local saved_health_level
local saved_agility_level
local succes, errormessage = pcall(function()
saved_points_level = myDataStore:GetAsync(player.UserId.."-points_lvl")
saved_health_level = myDataStore:GetAsync(player.UserId.."-health_lvl")
saved_agility_level = myDataStore:GetAsync(player.UserId.."-agility_lvl")
end)
if succes then
points_lvl.Value = saved_points_level
health_lvl.Value = saved_health_level
agility_lvl.Value = saved_agility_level
else
print("There was an error whilst getting your data")
end
end)
