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 debounce = false part.Touched:connect(function(part) if debounce == false then debounce = true local g = game.Players:GetPlayerFromCharacter(part.Parent) if part:IsA("Part") and (g) then pps = game:GetService("PointsService") if pps:GetAwardablePoints() >= 1 then wait(3) pps:AwardPoints(g.userId, 1) end wait(.2) debounce = false end) -- Got the red squiggly line thing!
My best guess is that you need to add debounce.
debounce = false part.Touched:connect(function(part) if debounce == false then debounce = true --your code wait(.2) debounce = false end)
You can read about debounce here.
Add a Debounce, and Add some wait()'s so that it would wait a little before giving the Player their Points, cos if u don't add a wait() then sometimes things do stuff as if they were called multiple times... I've Experienced that a ton of times...
Edit:
local part = script.Parent local Touching = false part.Touched:connect(function(part) if not Touching then Touching = true 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) wait(1) --This wait() will make everything Stop for 1 Second after the Player Point is Awarded, so that if your still Touching the Part it'll wait 1 Second so as not to keep giving u Points, it's basically like FireRate in a Gun but except there's only 1 Bullet... (And wen I said everything, I meant the Point Awarding) Touching = false end script.Parent:destroy() end end)
I'm pretty sure the problem with the current script is that it needs more ends.
part.Touched:connect(function(part)
This one needs an end).
if debounce == false then
if part:IsA("Part") and (g) then
if pps:GetAwardablePoints() >= 1 then
All 3 of these need ends. Looking at your script, it only has two ends when it needs four. I hope this helps.