I am making a game where I want a player to get awarded a player point when they kill another player. Please tell me where I went wrong

local PointsService = game:GetService("PointsService")
 
function awardPoints(creator)
	if time() - lastAwardedTime < 5 then 
            return
	else
		lastAwardedTime = time()
		PointsService:AwardPoints(creator.Value, 1)
	end
end

Also, I don't know where to put the script. Would I create a local script and leave it in workspace or am I suppose to put a regular script inside my weapon?