Hello I am Aidanmatt72 and I am trying to make a time based leveling leaderstat that saves
The issue i have is that the Leaderstsat does not show up
I have not tried any solutions as i know nothing about scripting
Here is my script
-- local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("LevelStats") -- Change this with a different name.
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local cash = Instance.new("IntValue")
cash.Name = "Level (Testing)"
cash.Value = 1
cash.Parent = stats
stats.Parent = newPlayer
while true do
wait(600)
cash.Value = cash.Value + 1
game.Players.ChildAdded:connect(onPlayerEntered)
game.Players.PlayerRemoving:Connect(function(Player)
end)
DataStore:SetAsync(Player.UserId, {
["Level"] = Player.leaderstats.Level.Value; -- Change "Level" with your currency.
})
end
end
-- local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("LevelStats") -- Change this with a different name.
function onPlayerEntered(newPlayer)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
local cash = Instance.new("IntValue")
cash.Name = "Level (Testing)"
cash.Value = 1
cash.Parent = stats
stats.Parent = newPlayer
while true do
wait(600)
cash.Value = cash.Value + 1
game.Players.ChildAdded:connect(onPlayerEntered)
game.Players.PlayerRemoving:Connect(function(Player)
end)
DataStore:SetAsync(Player.UserId, {
["Level"] = Player.leaderstats.Level.Value; -- Change "Level" with your currency.
})
end
end