Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.