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! :(
local ting = 0 --debouncer function onTouched(hit) if ting == 0 then --debounce check ting = 1 --activate debounce check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button player = hit.Parent if check ~= nil then --If a human is found, then local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human local stats = user:findFirstChild("leaderstats") --Find moneyholder if stats ~= nil then --If moneyholder exists then local cash = stats:findFirstChild("Stars") --Get money cash.Value = cash.Value +1 --increase amount of money by the number displayed here (1) wait(1) check.Health = 0 wait(4) --wait-time before button works again end end end ting = 0 --remove debounce end script.Parent.Touched:connect(onTouched)
Add a value to the players, example;
If you add a value to the players, and they touch the 'Star', it makes it true.