write a new roblox script where if the player accepts. the player gets teleported into a part named: "PlayerTeleporter" and the NPC. in "NPCTeleporter" as soon as they get teleported. the player can't move. then a gui named: "MainGui" has a frame named: "QuestionFrame" inside has 4 textbuttons. "Answer1" "Answer2" "Answer3, Answer4" and inside has a textlabel named: "Question". (there would be 5 questions. the questions are (Q1: What is 1 + 1?) (Q2: What is 4 x 8?) (Q3: What is 4 / 2) (Q4: What is 16 + 43?) (Q5: What is 81 / 9?) (the answers would shuffle fake answers. but one answer button would input the real answer. this would go on until 5 questions. if the player got it wrong. it would input for the question: "Wrong!!" and proceeds to the next question. it has a typing effect. for question and wrong. if the player got it right, input: "Correct!" and continue) (use this script as your reference: -- LocalScript in StarterPlayerScripts or inside NPCDialogue ScreenGui

local player = game.Players.LocalPlayer
local npc = workspace:WaitForChild("Level 1")
local proximityPrompt = npc:WaitForChild("UpperTorso"):WaitForChild("ProximityPrompt")
local playerGui = player:WaitForChild("PlayerGui")
local npcDialogueGui = playerGui:WaitForChild("NPCDialogue")

-- Ensure the GUI is hidden at the start
npcDialogueGui.Enabled = false

local debounce = false -- Prevents multiple activations

-- Function to create the typing effect
local function typeText(textLabel, textToType, typingSpeed, callback)
	textLabel.Text = ""
	for i = 1, #textToType do
		textLabel.Text = string.sub(textToType, 1, i)
		wait(typingSpeed)
	end
	if callback then
		callback()
	end
end

-- Get the Accept and Decline buttons globally to avoid multiple connections
local acceptButton = npcDialogueGui.Frame:WaitForChild("Accept")
local declineButton = npcDialogueGui.Frame:WaitForChild("Decline")

-- Connect the Accept button
acceptButton.Activated:Connect(function()
	-- Actions when Accept is clicked
	print("Player accepted the challenge!")
	-- Hide the GUI and reset
	npcDialogueGui.Enabled = false
	npcDialogueGui.Frame.Text.Text = ""
	acceptButton.Visible = false
	declineButton.Visible = false
	debounce = false
	-- Add any additional functionality here (e.g., start a battle)
end)

-- Connect the Decline button
declineButton.Activated:Connect(function()
	-- Actions when Decline is clicked
	print("Player declined the challenge.")
	-- Hide the GUI and reset
	npcDialogueGui.Enabled = false
	npcDialogueGui.Frame.Text.Text = ""
	acceptButton.Visible = false
	declineButton.Visible = false
	debounce = false
	-- Add any additional functionality here
end)

-- When the ProximityPrompt is triggered
proximityPrompt.Triggered:Connect(function()
	if debounce then return end
	debounce = true

	-- Make the GUI visible
	npcDialogueGui.Enabled = true

	-- Get the TextLabel
	local textLabel = npcDialogueGui.Frame:WaitForChild("Text")
	local typingSpeed = 0.05 -- Adjust typing speed as needed

	-- Ensure buttons are hidden before typing starts
	acceptButton.Visible = false
	declineButton.Visible = false

	-- Start the typing effect, and show buttons when done
	typeText(textLabel, "You think you're smart enough to defeat me?!", typingSpeed, function()
		-- Show the buttons after typing effect is complete
		acceptButton.Visible = true
		declineButton.Visible = true
	end)
end))