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
local press = false
local pointgiver = script.Parent
pointgiver.Touched:connect(function(pointgiver)
if not press then
press = true
local g = game.Players:GetPlayerFromCharacter(pointgiver.Parent)
if pointgiver:IsA("Part") and (g) then
pps = game:GetService("PointsService")
if pps:GetAwardablePoints() >= 1 then
local plr = pointgiver.Parent:findFirstChild("Humanoid")
if plr.Health == 100 then
wait(100)
pps:AwardPoints(g.userId, 10)
press = false
end
end
end
end
end)

------ 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...

enabled = true
function onTouched(hit)
if not enabled then return end
enabled = false 
local h = hit.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
h.Sit = true
end
enabled = true 
end 
script.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

if pps:GetAwardablePoints() >= 1 then

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

if pps:GetAwardablePoints() >= 10 then

and you should be fine.

Answer this question