It doesn’t seem to be working, there are a lot of red lines.
Can you send an image of the red lines?
that would help me fix this script.
(Sorry, I’m not on pc so I can’t test the script myself)
First red line, the
instance.new
should have a capaitalized “I”.
You should also add another quotation mark in the Instance.new("Folder")
as it only has one.
The second error, you misspelled success. Same for the third error.
Oh…I thought you were talking about errors on output!
I just forgot to close strings, my bad.
Just go to folder with red line and add a " at the end.
That should be enough
Hmmm, I did that and it still seems not to work. Am I missing something or was I only supposed to put the script into the folder and not do anything else because that is what I did.
Hmm…
Is It because the level Is Invisible to you?
That would explain why “not working”.
What do you mean? Why wouldn’t I be able to see the levels?
There’s nothing to display the level on player’s screen.
You would need a UI to do that.
I’m very confused right now, I want the levels to show up on the player list.
You’ll have to make the leaderstats firstly, then every time it adds a level, just take the current value of the “Level” leaderstat, and add one to itself.
I’ll change a little to be compatible with leaderstats.
Insert a Script in ServerScriptService :
local DataStoreService = game:GetService("DataStoreService")
local StatDataStore = DataStoreService:GetDataStore("StatsData")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local Level = Instance.new("IntValue",leaderstats)
Level.Name = ("Level")
local key = "p-"..plr.UserId
local sucess, errorm = pcall(function()
if sucess then
local LoadedData = StatDataStore:GetASync(key)
Level.Value = LoadedData[1]
else
end
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local leaderstats = plr:WaitForChild("leaderstats")
local Level = leaderstats:WaitForChild("Level")
local key = "p-"..plr.UserId
local StatsSaving = {Level}
local sucess, errorm = pcall(function()
if sucess then
StatDataStore:SetASync(key,StatsSaving)
else
end
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = plr:WaitForChild("StatsFolder")
local Level = leaderstats:WaitForChild("Level")
while true do
wait(60) -- 60 seconds = 1 minute so...
Level.Value = Level.Value + 1 -- How much levels earn every minute.
end
end)
Hope It helped.
Here is what it looks like so far, what would I add and where if I want it to go up a level every minute?
`local Players = game:GetService(“Players”)
local function leaderboardSetup(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
local level = Instance.new("IntValue")
level.Name = "level"
level.Value = level.Value +1
level.Parent = leaderstats
wait(60)
end
Players.PlayerAdded:Connect(leaderboardSetup)`