I have a error that says "ServerScriptService.Script:7: attempt to index nil with 'WaitForChild'"
game.Players.PlayerAdded:Connect(function() local leader = Instance.new('Folder') leader.Name = 'leaderboard' leader.Parent = game.Players.LocalPlayer local leadera = Instance.new('IntValue') leadera.Name = 'Cash' leadera.Parent = game:GetService("Players").LocalPlayer:WaitForChild("leaderboard") leadera.Value = '0' end)
Multiple things are wrong with this script. Local Player doesn't work in server side scripts. This looks like it's a Server side script.
Also its "leaderstats"
not "leaderboard"
replace what you have with the following, or change it to look like this:
game.Players.PlayerAdded:Connect(function(plr) local leader = Instance.new('Folder') leader.Name = 'leaderstats' leader.Parent = plr local leadera = Instance.new('IntValue') leadera.Name = 'Cash' leadera.Parent = leader leadera.Value = '0' end)
Hope this helps!
game.Players.LocalPlayer can only be accessed by a local script and player joined event gives you the player object itself so instead try this:
game.Players.PlayerAdded:Connect(function(plr) local leader = Instance.new('Folder') leader.Name = "leaderstats" leader.Parent = plr local leadera = Instance.new('IntValue') leadera.Name = "Cash" leadera.Parent = leader leadera.Value = 0 end)