plz tell me wats wrong! the person I made this for said it didnt show up, and then I tested in solo mode, and no values showed up, or any words on the leaderboard... and as well as am at asking yas about this leaderboard... the guy wants to know if its possible for this to add points every 12/24 hours even if someone isnt online... and he asked if I could make it saveable so that he wouldnt need to get a different script, cos he wanna have it all in 1 script... thnx for reading...
local stats = {"Points", "RW", "TDD"} game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" for _, stat in pairs(stats) do Instance.new("IntValue", leaderstats).Name = stat end end game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local money = Instance.new("IntValue", leaderstats) money.Name = "Points" money.Value = 0 end) while wait(3600) do for _,Player in pairs(game.Players:GetPlayers()) do if Player:FindFirstChild("leaderstats") then Player.leaderstats.Money.Value = Player.leaderstats.Money.Value +100 end end end
There are a couple of problems with your code. The primary problem is that you are missing a closing parenthesis on the first PlayerAdded method. This constitutes a syntax error and prevents ROBLOX from understanding your code. The second is that you are creating the "leaderstats" model twice.
The following code is tested:
local stats = {"Points", "RW", "TDD", "Money" } game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" for _, stat in pairs(stats) do local sv = Instance.new("IntValue", leaderstats) sv.Name = stat end end) while wait(3600) do for _,Player in pairs(game.Players:GetPlayers()) do if Player:FindFirstChild("leaderstats") then Player.leaderstats.Money.Value = Player.leaderstats.Money.Value +100 end end end
Create a new question to ask about adding points every 12/24 hours.
[Edit] To answer your questions, you can remove and add any values to the stats table, so yes you can remove "Money", however notice that in the final while loop, the money value is what gets incremented. If you remove money, you probably want to change that to Points where it says Money.
You do not need a space between "Money" and }
Updated:
local stats = {"Points", "RW", "TDD"} game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" for _, stat in pairs(stats) do local sv = Instance.new("IntValue", leaderstats) sv.Name = stat end end) while wait(3600) do for _,Player in pairs(game.Players:GetPlayers()) do if Player:FindFirstChild("leaderstats") then Player.leaderstats.Points.Value = Player.leaderstats.Points.Value +100 end end end
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local money = Instance.new("IntValue", leaderstats) money.Name = "Points" money.Value = 0 for _, stat in pairs(stats) do local sv = Instance.new("IntValue", leaderstats) --sv = statvalue sv.Name = stat end end while wait(3600) do for _,Player in pairs(game.Players:GetPlayers()) do if Player:FindFirstChild("leaderstats") then Player.leaderstats.Money.Value = Player.leaderstats.Money.Value +100 end end end
You dont need 2 PlayerAdded events.