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

Player Points From Tool Instead of Player?

So this was a revision for my other question I answered, but basically how can I obtain player points through a tool that I have equipped? Here are the two scripts.

--this is where the tool will hit.

local debounce = false

script.Parent.Touched:connect(function(hit)
	if not debounce then
		debounce = true
		local look = hit.Parent:findFirstChild("BallHandler").Value
			local found = game.Players:findFirstChild(look)
			local cash = found:findFirstChild("leaderstats")
			cash['Shots Made'].Value = cash['Shots Made'].Value+1
			print("Gave +1 SM")
			wait(1)
		debounce = false
	end
end)

--this is what "BallHandler" is.

while wait() do
	plr=game.Players:FindFirstChild(script.Parent.Parent.Parent.Name)
	if plr then
		script.Parent.Value=plr.Name
	end
end

How would I make it so that I would get 1 Player Point whenever I touched that part with the tool I'm using?

Thanks, LukeGabrieI

1 answer

hehe got it

local debounce = false
local Points = 1

script.Parent.Touched:connect(function(hit)
    if not debounce then
        debounce = true
        local look = hit.Parent:findFirstChild("BallHandler").Value
            local found = game.Players:findFirstChild(look)
            local cash = found:findFirstChild("leaderstats")
            cash['Shots Made'].Value = cash['Shots Made'].Value+1
            print("Gave +1 SM")
			local pps = game:GetService("PointsService")
			if pps:GetAwardablePoints() >= 0 then
       	 	pps:AwardPoints(found.userId, Points)
            wait(1)
        debounce = false
			end
	end
end)

        	





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