Server Manager Help needed

Heya, You made a automatic quiz center is there also a script that is sends a webhook to Discord?

( Roblox Tutorial - How to make an automatic quiz center - YouTube )

1 Like

We could certainly figure out a solution!

#1 Please change the category to #scripting-support

Before we start do you have any experience with this stuff (making webhooks :spider_web: from roblox to discord)?

Also, what are you trying to do. (More details please).

When will we send something to discord, I need more facts, then I can assist you.

Hey, not really. Well I want to make a log that if anyone used the center that it logs that someone is ranked etc.

I need more details, what log, like when the pass?

Yes, when it pass or fails. That it send like “user” has faild or pass the centre

I think we could do that, send me your server code.

Remember to use the code tag option!

Im new in this, What is “server code”?

It’s self explanatory, were is the “server code” saved?

You mean my Discord server code?

No. On your roblox game.

Have a look through the explorer yourself, it’s quite self explanatory, I want you to learn something, and not to spoon feed you.

I don’t see how the post title relates to your question-

7684010223

this?

No the script in server script services.

Send me the content. The script is called “ServerManager”.

--[[
	@author TwinPlayzDev_YT
	@since 9/13/2021
	
	This script manages the questions.
	
	youtube.com/c/TwinPlayz_YT
--]]

return {
	ReplUrl = "https://UnitedKingdom.eddiestubezakel.repl.co/"; 		--  PUT Repl URL
	DiscordWebhook = "https://discord.com/api/webhooks/896163524139679766/IMSZM-q_SYAdOStHsfveh1AFDhQeC4h91COYdJq5uJnmkoBcgAAiZ4D4jrBiXD5akoq0"; -- PUT Discord WebHOOK URL
	Key = "132123123"; -- PUT RANDOM Key
	Group = 6841479; 										-- Group Id
	PassRank = 3; 											-- Pass Rank
	MistakesAllowed = 2;									-- How Many Mistakes
	Title = "Application Quiz Center";  					-- Title 
	Image = "rbxassetid://6808452143";  					-- Image

	Questions = { 											-- Questions (COPY AND PASTE)
		{
			Question = ". Who is our current Founder?"; 
			Options = {"PersesTheTitan"; "SinghXValor"; "Jim"; "Expective_NL"};
			Correct = "PersesTheTitan"
		};
		{
			Question = "Who is our Group Management?"; 
			Options = {"Expective_NL"; "Tiger";"k1dnn";"Bradolink";};
			Correct =  "Expective_NL"
		};
		{
			Question = " Which side of the road we drive?"; 
			Options = {"Right"; "Middle"; "Left";};
			Correct =  "Left"
		};
		{
			Question = " Who is our current Monarch?"; 
			Options = {"BradPlaysFTW"; "PersesTheTitan"; "TigerFX"; "KyleSWoodwin";};
			Correct =  "BradPlaysFTW"
		};

	}

}

--Variables

local ApiKey = script.ApiKey.Value
local GroupId = script.GroupId.Value
local HttpService = game:GetService("HttpService")
local AppUrl = script.AppUrl.Value
local req_points = 0
local TotalQuestions = 0
local CorrectAnswers = 0
local CompletedQuestions = 0 
local checking = false
local PassedRank = 1
local url = script.AppUrl.Value
local APIKEY = script.ApiKey.Value
local groupId = script.GroupId.Value

--OnServerEvent

game.ReplicatedStorage.SendData.OnServerEvent:Connect(function(players, Req, total, PassRank)
	req_points = Req
	TotalQuestions = total
	PassedRank = PassRank
end)

--ManageQuestions

wait(5)
game.ReplicatedStorage.NextQuestion:FireAllClients() --Waits and then does first question


--Remote Events

game.ReplicatedStorage.PointStatus.OnServerEvent:Connect(function(player, status)
	if status == true then
		if CompletedQuestions <=  TotalQuestions then
			CorrectAnswers = CorrectAnswers +1
			print("Current points: " ..CorrectAnswers)
			CompletedQuestions = CompletedQuestions +1
			wait(3)
			game.ReplicatedStorage.NextQuestion:FireAllClients()
		end
	else
		if CompletedQuestions <= TotalQuestions then
			print("Current points: " ..CorrectAnswers)
			CompletedQuestions = CompletedQuestions +1
			wait(3)
			game.ReplicatedStorage.NextQuestion:FireAllClients()
			print("Current points: " ..CorrectAnswers)
		end
	end
end)


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)


Great. Now ,we need to combine this code together!

Now where do you think in our server code it says that we pass?