Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Point Award Script & Check for sitting script - Do not work ??

Asked by 10 years ago
01local press = false
02local pointgiver = script.Parent
03pointgiver.Touched:connect(function(pointgiver)
04if not press then
05press = true
06local g = game.Players:GetPlayerFromCharacter(pointgiver.Parent)
07if pointgiver:IsA("Part") and (g) then
08pps = game:GetService("PointsService")
09if pps:GetAwardablePoints() >= 1 then
10local plr = pointgiver.Parent:findFirstChild("Humanoid")
11if plr.Health == 100 then
12wait(100)
13pps:AwardPoints(g.userId, 10)
14press = false
15end
16end
17end
18end
19end)

------ The above script breaks after hitting it a few times, when I'm testing it on wait(1), I need some ways of fixing it, and I can't figure those myself...

01enabled = true
02function onTouched(hit)
03if not enabled then return end
04enabled = false
05local h = hit.Parent:findFirstChild("Humanoid")
06if (h ~= nil) then
07h.Sit = true
08end
09enabled = true
10end
11script.Parent.Touched:connect(onTouched)

---------- The above script also seems to break after testing it.. This might have an issue with debounce, which probably requires a wait(), but are there any other issues with this?

2 answers

Log in to vote
1
Answered by 10 years ago

Any idea what might be wrong with the second script? I've edited the first one within my place, I will be testing that later on in the day with real players.

Ad
Log in to vote
0
Answered by 10 years ago

The playerpoint script breaks because you did

1if pps:GetAwardablePoints() >= 1 then

and it gives the player 10 PP. So change it to

1if pps:GetAwardablePoints() >= 10 then

and you should be fine.

Answer this question