game.Workspace.PlayerAdded(function(player) local stats = Instance.new("IntValue", player) stats.Name = "leaderstats" local points = Instance.new("IntValue", player.leaderstats) points.Name = "Points" local wins = Instance.new("IntValue", player.leaderstats) wins.Name = "Wins" end)
What in the world is the problem? Basically, what the script does is load an IntValue and creates a leaderboard. It's not working, but I don't receive an error about WHY it doesn't work.
You haven't initialized leaderstats, and you're calling PlayerAdded on the wrong service. Your code should look like this:
game.Players.PlayerAdded:connect(function(player) --PlayerAdded is for game.Players, not game.Workspace. --Initialize the leaderstats model in the player local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" --Initialize a leaderboard value local pts = Instance.new("IntValue", leaderstats) pts.Name = "Points" pts.Value = "0" --Set default value, data persistence overrides this. end
PlayerAdded
isn't associated with Workspace, but with the Players service instead. I don't believe parenting stats to the character would display them on the leaderboard.