How do I get this script to work once per player?
Ok so I made a script where you touch a part and you get a Point in the leaderboard. I called the Points Stars. How do I get this script to work once for each player. For example a guy gets the star and in the leaderboards it says he has 1 star. Then he goes up to it again and he doesn't get another star from that one because he already has it. Please help I kept trying but when I did it just didn't work! :(
03 | function onTouched(hit) |
07 | check = hit.Parent:FindFirstChild( "Humanoid" ) |
12 | local user = game.Players:GetPlayerFromCharacter(hit.Parent) |
13 | local stats = user:findFirstChild( "leaderstats" ) |
17 | local cash = stats:findFirstChild( "Stars" ) |
19 | cash.Value = cash.Value + 1 |
32 | script.Parent.Touched:connect(onTouched) |