I have a few scripts that worked on a glitch API system. I wanted to move them over to the Heroku system. When I moved it over it stopped working. Any way I can fix these two scripts?
local http = game:GetService("HttpService")
local MarketplaceService = game:GetService("MarketplaceService")
local WrongAnswersToFail = 3
local PassRank = 6
local url = "Application_URL"
local APIKEY = "API_KEY_HERE"
local groupId = 5344349
local gamepassid = 0
local discordWebhookurl = ""
function rankUser(UserId, RoleId)
game:GetService("HttpService"):GetAsync( url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..PassRank)
end
local function format(num, digits)
return string.format("%0" .. digits .. "i", num)
end
local function parseDateTime()
local osDate = os.date("!*t")
local year, mon, day = osDate["year"], osDate["month"], osDate["day"]
local hour, min, sec = osDate["hour"], osDate["min"], osDate["sec"]
return year .. "-" .. format(mon, 2) .. "-" .. format(day, 2) .. "T" .. format(hour, 2) .. ":" .. format(min, 2) .. ":" .. format(sec, 2) .. "Z"
end
local FinishText = Instance.new("StringValue", game.Lighting)
FinishText.Name = "FinishText"
function passUser(Player)
game.Lighting.FinishText.Value = "You have passed your application.... please wait while we rank you......."
rankUser(Player.UserId, PassRank)
local Data = {
["embeds"] = {{
["author"] = {
["name"] = Player.Name,
["url"] = "https://www.roblox.com/users/"..tostring(Player.UserId).."/profile",
["icon_url"] = ""
},
["title"] = "Application Log",
["description"] = Player.Name.." has **passed** their application. They should have been ranked.",
["footer"] = {
["text"] = "User ID: " .. tostring(Player.UserId)
},
["color"] = 3468099,
["timestamp"] = parseDateTime()
}}
}
Data = http:JSONEncode(Data)
--http:PostAsync(discordWebhookurl, Data)
end
function skipUser(Player)
game.ReplicatedStorage.SkipApplicationEvent:FireClient(Player)
game.Lighting.FinishText.Value = "You've skipped your application! Ranking you now..."
rankUser(Player.UserId, PassRank)
local Data = {
["embeds"] = {{
["author"] = {
["name"] = Player.Name,
["url"] = "https://www.roblox.com/users/"..tostring(Player.UserId).."/profile",
["icon_url"] = ""
},
["title"] = "Application Log",
["description"] = Player.Name.." has **skipped** their application.",
["footer"] = {
["text"] = "User ID: " .. tostring(Player.UserId)
},
["color"] = 13434739,
["timestamp"] = parseDateTime()
}}
}
Data = http:JSONEncode(Data)
--http:PostAsync(discordWebhookurl, Data)
end
function skipUser2(Player)
rankUser(Player.UserId, PassRank)
local Data = {
["embeds"] = {{
["author"] = {
["name"] = Player.Name,
["url"] = "https://www.roblox.com/users/"..tostring(Player.UserId).."/profile",
["icon_url"] = ""
},
["title"] = "Application Log",
["description"] = Player.Name.." has **skipped** their application.",
["footer"] = {
["text"] = "User ID: " .. tostring(Player.UserId)
},
["color"] = 13434739,
["timestamp"] = parseDateTime()
}}
}
Data = http:JSONEncode(Data)
--http:PostAsync(discordWebhookurl, Data)
wait(3)
Player:Kick('\nSuccessfully ranked! Please inform an Executive+ if you haven\'t been ranked.')
end
function failUser(Player)
game.Lighting.FinishText.Value = "You've failed your application. Try again later!"
local Data = {
["embeds"] = {{
["author"] = {
["name"] = Player.Name,
["url"] = "https://www.roblox.com/users/"..tostring(Player.UserId).."/profile",
["icon_url"] = ""
},
["title"] = "Application Log",
["description"] = Player.Name.." has **failed** their application.",
["footer"] = {
["text"] = "User ID: " .. tostring(Player.UserId)
},
["color"] = 15158605,
["timestamp"] = parseDateTime()
}}
}
Data = http:JSONEncode(Data)
--http:PostAsync(discordWebhookurl, Data)
wait(5)
Player:Kick("Failed\nYou've failed your application. Try again later!")
end
game.Players.PlayerAdded:Connect(function(Player)
local Data = {
["embeds"] = {{
["author"] = {
["name"] = Player.Name,
["url"] = "https://www.roblox.com/users/"..tostring(Player.UserId).."/profile",
["icon_url"] = "https://www.roblox.com/headshot-thumbnail/image?userId="..tostring(Player.UserId).."&width=420&height=420&format=png"
},
["title"] = "Player Joined",
["description"] = Player.Name.." has **joined** the application center .",
["footer"] = {
["text"] = "User ID: " .. tostring(Player.UserId)
},
["color"] = 51455,
["timestamp"] = parseDateTime()
}}
}
Data = http:JSONEncode(Data)
--http:PostAsync(discordWebhookurl, Data)
end)
game.ReplicatedStorage.Prompt.OnServerEvent:Connect(function(Player,plr)
MarketplaceService:PromptGamePassPurchase(Player,gamepassid)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == gamepassid then
skipUser(player)
end
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == false and purchasedPassID == gamepassid then
game.ReplicatedStorage.Back:FireClient(Player)
end
end)
local hasPass = false
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, gamepassid)
end)
if not success then
warn("Error while checking if player has pass: " .. tostring(message))
return
end
if hasPass == true then
skipUser(Player)
end
end)
game.ReplicatedStorage.Prompt2.OnServerEvent:Connect(function(Player,plr)
MarketplaceService:PromptGamePassPurchase(Player,gamepassid)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == gamepassid then
game.ReplicatedStorage.PleaseWait:FireClient(Player)
skipUser2(player)
end
end)
local hasPass = false
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, gamepassid)
end)
if not success then
warn("Error while checking if player has pass: " .. tostring(message))
return
end
if hasPass == true then
skipUser(Player)
end
end)
game.ReplicatedStorage.FinishApplicationEvent.OnServerEvent:Connect(function(Player, Questions, UserAnswers)
local IncorrectAnswers = 0
for i = 1, #Questions do
local CorrectAnswer = Questions[i][6]
if CorrectAnswer ~= UserAnswers[i] then
IncorrectAnswers = IncorrectAnswers + 1
end
end
if IncorrectAnswers >= WrongAnswersToFail then
failUser(Player)
else
passUser(Player)
end
end)
–
local Http = game:GetService("HttpService")
local DiscordWebhook = ""
local GroupId = 8428801
local url = "Application_URL"
local APIKEY = "API_KEY_HERE"
local date = os.date("!*t")
function rankUser(UserId,RoleId) -- Rank user function.
Http:GetAsync(url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..PassRank) -- Ranking them online.
end
game.Players.PlayerAdded:Connect(function(plr)
local Minutes = plr:WaitForChild("leaderstats").Minutes -- Local leaderstat
local Data = { -- Making A Rank Message
["content"] = plr.Name.." ,was just ranked. | "..date.month.."/"..date.day.."/"..date.year
}
Data = Http:JSONEncode(Data)
if plr:IsInGroup(GroupId) and plr:GetRankInGroup(GroupId) >= 1 then
Minutes.Changed:Connect(function()
local RoleId
if Minutes.Value >= 100000 then
RoleId=4
rankUser(plr.UserId,RoleId)
Http:PostAsync(DiscordWebhook, Data)
elseif Minutes.Value >= 10000 then
RoleId=3
rankUser(plr.UserId,RoleId)
Http:PostAsync(DiscordWebhook, Data)
elseif Minutes.Value >= 5000 then
RoleId=2
rankUser(plr.UserId,RoleId)
Http:PostAsync(DiscordWebhook, Data)
end
end)
end
end)
No errors in the output,