i want to show an amout of points on a label, and for some reason i get this error
Players.Medoozi.PlayerGui.InsertedObjects.Gradient.TextLabel.LocalScript:8: attempt to index nil with 'points i've checked and i havent misstyped anything...
1 | local Players = game:GetService( "Players" ) |
2 | local number = script.Parent |
3 | local player = game.Players.LocalPlayer |
4 | local leaderstats = Players:FindFirstChild( "leaderstats" ) |
5 |
6 | while true do |
7 | wait() |
8 | number.Text = "Cash:" ..leaderstats.points.Value.. "$" |
9 | end |
On Line 4, you are trying to find the child named "leaderstats" inside the Players service. This will most definitely return nil because the instance you're trying to find is not a child of Players. Instead of "Players:FindFirstChild("leaderstats")", you should do "player:FindFirstChild("leaderstats")".
Hope this works! if it works, mark it as an answer because it helps out everyone. If it didn't work, leave a comment and I'll try to find another solution.