I want to award all players who have played my game (without using badges!) for whenever my game reaches a like/favorite goal.
At the moment, all I can do is just Players:GetPlayers()
, but that only rewards the players who happen to be in game when the reward is reached, and so a lot of players miss out on the reward.
local GOAL_INCREMENT = 100
--// Round to nearest GOAL_INCREMENT
local function GetGoal(number)
local Divided = number / GOAL_INCREMENT
local Rounded = GOAL_INCREMENT * math.floor(Divided)
return Rounded + GOAL_INCREMENT
end
local Likes = GameStatsManager.GetLikes()
local Favorites = GameStatsManager.GetFavs()
local LikeGoal = GetGoal(Likes)
local FavoriteGoal = GetGoal(Favorites)
if Likes >= LikeGoal then
Award()
end
if Favorites >= FavoriteGoal then
Award()
end
I’m not gonna post the GetLikes()
and GetFavs()
functions, but they basically just return the number of likes and favorites on the game