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

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

Asked by 10 years ago

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)
0
Didn't roblox just release the 100x points in each server update? HexC3D 830 — 10y
0
1 * 100 = 7? Logic... (Oh and * is Times just to let you know if you dodn't before) :P Michael007800 144 — 10y
0
By the way I already knew "*" is the multiplication operator in Lua, nor is my logic flawed..... HexC3D 830 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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

0
Doesn't work, no output avalible... Michael007800 144 — 10y
0
I thought that debounce should work. Im still looking into it. Tempestatem 884 — 10y
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. deaththerapy 60 — 10y
1
Yeah :Destroy() is what I use. I voted you up michael, because it seems someone is abusing their power. Tempestatem 884 — 10y
View all comments (3 more)
0
I don't like abusers on scripting helpers to be honest. HexC3D 830 — 10y
0
I'll try that. I hope it works as at the rate I'm going through points, I have like 20 runs left! Michael007800 144 — 10y
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 Tempestatem 884 — 10y
Ad

Answer this question