i need help for something. it my script (i want Exemple if someone touch the part that give one points only) INFO : WHEN I TOUCH IT, IT GIVE 160 POINTS AND I JUST ONE ONLY 1 POINT
1 | WinPlace 1 = script.Parent |
2 | WinPlace 1. Touched:connect( function () |
3 | print (game.Players.LocalPlayer) |
4 | wait( 3 ) |
5 | game.Players.LocalPlayer.leaderstats.point.Value = game.Players.LocalPlayer.leaderstats.point.Value + 1 |
6 | end ) |
You'll want to add a debounce, here's the new code.
01 | WinPlace 1 = script.Parent |
02 | Debounce = false |
03 |
04 | WinPlace 1. Touched:connect( function () |
05 | print (game.Players.LocalPlayer) |
06 |
07 | if Debounce = = false then |
08 | Debounce = true |
09 |
10 | game.Players.LocalPlayer.leaderstats.point.Value = game.Players.LocalPlayer.leaderstats.point.Value + 1 |
11 |
12 | Debounce = false |
13 | end |
14 | end ) |
@helperobc That's a good way to do it too
Here's another way (Add a delay):
1 | WinPlace 1 = script.Parent |
2 | WinPlace 1. Touched:connect( function () |
3 | script.Disabled = true |
4 | print (game.Players.LocalPlayer) |
5 | wait( 3 ) |
6 | game.Players.LocalPlayer.leaderstats.point.Value = game.Players.LocalPlayer.leaderstats.point.Value + 1 |
7 | wait( 5 ) |
8 | script.Disabled = false |
9 | end ) |