So this was a revision for my other question I answered, but basically how can I obtain player points through a tool that I have equipped? Here are the two scripts.
--this is where the tool will hit.
01 | local debounce = false |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | if not debounce then |
05 | debounce = true |
06 | local look = hit.Parent:findFirstChild( "BallHandler" ).Value |
07 | local found = game.Players:findFirstChild(look) |
08 | local cash = found:findFirstChild( "leaderstats" ) |
09 | cash [ 'Shots Made' ] .Value = cash [ 'Shots Made' ] .Value+ 1 |
10 | print ( "Gave +1 SM" ) |
11 | wait( 1 ) |
12 | debounce = false |
13 | end |
14 | end ) |
--this is what "BallHandler" is.
1 | while wait() do |
2 | plr = game.Players:FindFirstChild(script.Parent.Parent.Parent.Name) |
3 | if plr then |
4 | script.Parent.Value = plr.Name |
5 | end |
6 | end |
How would I make it so that I would get 1 Player Point whenever I touched that part with the tool I'm using?
Thanks, LukeGabrieI
hehe got it
01 | local debounce = false |
02 | local Points = 1 |
03 |
04 | script.Parent.Touched:connect( function (hit) |
05 | if not debounce then |
06 | debounce = true |
07 | local look = hit.Parent:findFirstChild( "BallHandler" ).Value |
08 | local found = game.Players:findFirstChild(look) |
09 | local cash = found:findFirstChild( "leaderstats" ) |
10 | cash [ 'Shots Made' ] .Value = cash [ 'Shots Made' ] .Value+ 1 |
11 | print ( "Gave +1 SM" ) |
12 | local pps = game:GetService( "PointsService" ) |
13 | if pps:GetAwardablePoints() > = 0 then |
14 | pps:AwardPoints(found.userId, Points) |
15 | wait( 1 ) |
16 | debounce = false |
17 | end |
18 | end |
19 | end ) |