Automatic Point Promotion System | Code

Server Script:

local HttpService = game:GetService("HttpService")

local ApiKey = "CookieTechTutorial"
local AppUrl = "https://robloxrankerbot.herokuapp.com/group/rank"
local PlayerPromotionSuccess = game.ReplicatedStorage:WaitForChild("PlayerPromotionSuccess")


local GroupId = 10392184

local PointsRequired = {
	[2] = 60,
	[3] = 120 
}


local function Promote(plr, passedRank)
	if plr:GetRankInGroup(GroupId) < passedRank then
		local Full_Url = AppUrl.."?user_name="..plr.Name.."&key=".. ApiKey.. "&groupid="..GroupId.."&role_number="..passedRank
		local Response = HttpService:GetAsync(Full_Url)
		local Data = HttpService:JSONDecode(Response)
		PlayerPromotionSuccess:FireClient(plr)
	end
end


game.Players.PlayerAdded:Connect(function(Player)
	local Player_Leaderstats = Player:WaitForChild("leaderstats").Points
	Player_Leaderstats.Changed:Connect(function()
		for i,v in pairs(PointsRequired) do
			if v == Player_Leaderstats.Value then
				Promote(Player, i)
			end
		end
	end)
end)

Local Script:

game.ReplicatedStorage.PlayerPromotionSuccess.OnClientEvent:Connect(function()
		game.StarterGui:SetCore("SendNotification",{
			Title = "Promotion!",
			Text = "You earned enough points to get promoted!",
			Icon = "",
			Duration = 5
		})
end)

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.