I made this leaderboard script:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local Points = Instance.new("IntValue")
Points.Name = "Points"
end)
the script works well but im trying to make it so that when someone has 5 points a door opens but it gives me an error saying that leaderstats is not a valid member of player, this is the script for the door:
game.Players.PlayerAdded:Connect(function(player)
if player.leaderstats.Points.Value == 5 then
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
end
end)
i've tried a lot of stuff and asked my friends but we haven't been able to figure it out why it gives me that error.

2 comments
bruh do not think it will work he is trying to make a "leaderstats"
What are you talking about?