I have a couple of suggestions. Feel free to completely disregard what i'm saying if you disagree....
If you'd like things to not show up under leaderboards, you can always just add a folder within the leaderstats folder or whatever it is...
This creates a leaderstats & a hidden folder
leaderstats are under player and hidden is under the leaderstats
The cool part is... Only values under leaderstats will show.. Therefor you won't see 'Hidden' in the players leaderstats
local Players = game:GetService('Players')
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new('Folder')
leaderstats.Name = 'leaderstats'
local NonHidden = Instance.new('NumberValue')
NonHidden.Name = 'NonHidden'
NonHidden.Value = 5
NonHidden.Parent = leaderstats
local hidden = Instance.new('Folder')
hidden.Name = 'Hidden'
local HiddenValue = Instance.new('NumberValue')
HiddenValue.Name = 'HiddenValue'
HiddenValue.Value = 500
HiddenValue.Parent = hidden
hidden.Parent = leaderstats
leaderstats.Parent = player
end)
click this link to see the outcome of this script
the value is still going to be there although it's now hidden..
Anyways
You're not really giving enough information for us to be able to give you reliable information.
I don't know how you have your scripts set up with the leaderstats and things.. But I redid the code you gave with what I mentioned above..
I don't expect you to copy... But I do expect you to read over and learn why I did what I did.
I also have a bunch of if statements making sure things don't end up being nil, if they are then it won't cause an error, it'll just print what the issue was..
local Players = game:GetService('Players')
local function AddTickets(player,stats)
local leaderstats = stats ~= nil and stats or player:FindFirstChild('leaderstats')
if leaderstats then
local hidden = leaderstats:FindFirstChild('Hidden')
if hidden then
local Tickets = leaderstats:FindFirstChild('Tickets')
local Cps = hidden:FindFirstChild('Cps')
if Tickets and Cps then
while true do
leaderstats.Tickets.Value = leaderstats.Tickets.Value + hidden.Cps.Value
wait(1)
end
elseif Tickets == nil then
print('Tickets was not found under leaderstats')
elseif Cps == nil then
print('CPS was not found under hidden')
end
else
print('Hidden was not found under',player)
end
else
print('leaderstats were not found under',player)
end
end
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new('Folder')
leaderstats.Name = 'leaderstats'
local Tickets = Instance.new('NumberValue')
Tickets.Name = 'Tickets'
Tickets.Parent = leaderstats
local Rebirths = Instance.new('NumberValue')
Rebirths.Name = 'Rebirths'
Rebirths.Parent = leaderstats
local hidden = Instance.new('Folder')
hidden.Name = 'Hidden'
local cps = Instance.new('NumberValue')
cps.Name = 'Cps'
cps.Value = 1
cps.Parent = hidden
hidden.Parent = leaderstats
leaderstats.Parent = player
AddTickets(player)
end)
If you have any questions at all, feel free to comment on this.
2 comments
Also, I have another script which creates a folder of the player's name in the "RemoteData" folder and in the "RemoteData" folder there is a IntValue called Cps.
I would recommend adding a WaitForChild function for Cps