Euhm, I think the “passrank”
Not quite, look again. Look at the code and true looking for where it promotes the user.
local function promoteStatus(plr)
print("Now ranking!")
local url_with_data = url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..PassedRank
local response = HttpService:GetAsync(url_with_data)
local data = HttpService:JSONDecode(response)
wait(5)
plr:kick("You were promoted! \n You should have been ranked in the group!")
end
game.ReplicatedStorage.CheckIfPassed.OnServerEvent:Connect(function(PlayerInstance)
print("Checking.")
if CorrectAnswers >= req_points then
game.ReplicatedStorage.PromotionStatus:FireAllClients(true)
promoteStatus(PlayerInstance)
else
game.ReplicatedStorage.PromotionStatus:FireAllClients(false)
PlayerInstance:Kick("You failed the application. \n try again later!")
end
end)
Good. Now, we need to integrate this into sending a message to discord.
So code like this should work:
local function promoteStatus(plr)
print("Now ranking!")
local url_with_data = url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..PassedRank
local response = HttpService:GetAsync(url_with_data)
local data = HttpService:JSONDecode(response)
local Data = {
["content"] = plr.Name .."was promoted as they passed the quiz!"
}
Data = http:JSONEncode(Data)
http:PostAsync("", Data) --Put the webhook you saved between the two quotes.
wait(5)
plr:kick("You were promoted! \n You should have been ranked in the group!")
end
game.ReplicatedStorage.CheckIfPassed.OnServerEvent:Connect(function(PlayerInstance)
print("Checking.")
if CorrectAnswers >= req_points then
game.ReplicatedStorage.PromotionStatus:FireAllClients(true)
promoteStatus(PlayerInstance)
else
local data = HttpService:JSONDecode(response)
local Data = {
["content"] = plr.Name .."failed as they did not get enough questions correct in the quiz!"
}
Data = http:JSONEncode(Data)
http:PostAsync("", Data) --Put the webhook you saved between the two quotes.
game.ReplicatedStorage.PromotionStatus:FireAllClients(false)
PlayerInstance:Kick("You failed the application. \n try again later!")
end
end)
Set “http” to “HttpService”.
Delete the “local data = HttpService:Decode” error.
Now I can’t acces my edit, nice
Wait a few hours. Roblox is down.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.