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

Why does this script keep awarding 7 points? [ANSWER DIDN'T HELP]

I have a Motorcross game (Fairly popular) and every time someone crosses the finish, it awards 7 points! Not 1! At the rate it's going, it'll run out in 40 races!

local part = script.Parent
part.Touched:connect(function(part)
local g = game.Players:GetPlayerFromCharacter(part.Parent)
if part:IsA("Part") and (g) then
pps = game:GetService("PointsService")
if pps:GetAwardablePoints() >= 1 then
    pps:AwardPoints(g.userId, 1)
end
script.Parent:remove()
end
end)

3 comments

0

Didn't roblox just release the 100x points in each server update?

0

1 * 100 = 7? Logic... (Oh and * is Times just to let you know if you dodn't before) :P

0

By the way I already knew "*" is the multiplication operator in Lua, nor is my logic flawed.....

1 answer

You should add a debounce

debounce=true
local part = script.Parent
part.Touched:connect(function(part)
local g = game.Players:GetPlayerFromCharacter(part.Parent)
if debounce==true then
debounce=false
if part:IsA("Part") and (g) then
pps = game:GetService("PointsService")
if pps:GetAwardablePoints() >= 1 then
    pps:AwardPoints(g.userId, 1)
end
script.Parent:remove()
end
end)

If it doesn't work, tell me the output in a comment

7 comments

0

Doesn't work, no output avalible...

0

I thought that debounce should work. Im still looking into it.

0

One small thing. It probably isn't related, but remove() has been depricated. While it seems to still be accepted for now, it's best to just use Destroy() instead.

1

Yeah :Destroy() is what I use. I voted you up michael, because it seems someone is abusing their power.

0

I don't like abusers on scripting helpers to be honest.

0

I'll try that. I hope it works as at the rate I'm going through points, I have like 20 runs left!

0

Well, you could always have it, instead of award a point, you can make it print something. So instead of using all the points, it will just print something that you can see in output

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