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

pls help me change it?

hai guys i just asking if u can fix this so it can give random player points

PointsService = game:GetService("PointsService")
ammount = 1 -- Ammount of player points awarded after the interval.
time = 1 -- Interval between each player point award.

game.Players.PlayerAdded:connect(function(p)
	while true do
		wait(time*60)
		game:GetService("PointsService"):AwardPoints(p.userId,ammount)
	end
end)

1 answer

PointsService = game:GetService("PointsService")
amount = 1 -- Amount of player points awarded after the interval.
timewait = 1 -- Interval between each player point award.

game.Players.PlayerAdded:connect(function(p)
    while true do
	balance = PointsService:GetAwardablePoints()
	if balance >= amount then
		pcall(function()
			PointsService:AwardPoints(p.userId, amount)
		end)
	else pcall(function()
		PointsService:AwardPoints(p.userId, balance)
		end)
	end
	wait(timewait*60)
    end
end)

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