local Players = game:GetService("Players")
local function leaderboardSetup(player)
end
-- Connect the "leaderboardSetup()" function to the "PlayerAdded" event Players.PlayerAdded:Connect(leaderboardSetup)
the word "game" was red
Try this:
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") --or ("Folder",player) leaderstats.Parent = player --remove this if you did ("Folder",player) leaderstats.Name = "leaderstats" --Don't change this local Points = Instance.new("IntValue") --or ("IntValue", leaderstats) Points.Parent = leaderstats --remove this if you did ("Folder",player) Points.name = "Points" Points.Value = 5 --You can change the value end) --You can change Points to any name.
Make sure that the script is inside ServerScriptService Make sure it's script and not local script.
I'm not sure what you're trying to achieve here, but I'll show an example on how to create a leaderboard.
local Players = game:GetService("Players") Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local points = Instance.new("IntValue", leaderstats) points.Name = "Points" points.Value = 0 end)
"PlayerAdded" is an event to detect if a player joined, and I'm connecting it to the function. Next you want to create a folder with the name "leaderstats" to be detected as a leaderboard for roblox's built in leaderboard system. You can then create values and parent them to the leaderboard to be displayed. I recommend reading about how functions and leaderboards work on the roblox wiki, here's some links.