return function(z,y)if y then setfenv(1,y)end if not z.Question then return end local H=z.gTable local d=script.Parent.Parent.BaseClip local m=z.Duration or z.Timeout local X local b=d.Frame local q=b q.Parent=d q.Position=UDim2.new(.5,-210,0,-q.Size.Y.Offset)q.Visible=true local i=q:WaitForChild("\066\111\100\121")local U=i:WaitForChild("\079\112\116\105\111\110\115")local N,j=U:WaitForChild("\067\111\110\102\105\114\109"),U:WaitForChild("\067\097\110\099\101\108")local M=i:WaitForChild("\067\111\109\109\097\110\100")local P=b.Top.Title M.Text=z.Subtitle or" "i.Ques.Text=z.Question or"\085\110\107\110\111\119\110"P.Text=z.Title or"\089\101\115\047\078\111 \080\114\111\109\112\116"i.Options.Cancel.Text=z.No or"\078\111"i.Options.Confirm.Text=z.Yes or"\089\101\115"H:Ready()H.CustomDestroy=function()H.CustomDestroy=nil H.ClearEvents()if X==nil then X=z.No or"\078\111"end pcall(function()q:TweenPosition(UDim2.new(.5,-210,1,0),"\079\117\116","\081\117\105\110\116",.3,true,function(z)if z==Enum.TweenStatus.Completed then q:Destroy()end end)wait(.3)end)H:Destroy()end q:TweenPosition(UDim2.new(.5,-210,.5,-70),"\079\117\116","\081\117\105\110\116",.3,true)local C C=H.BindEvent(N.MouseButton1Click,function()C:Disconnect()q:TweenPosition(UDim2.new(.5,-210,1,0),"\079\117\116","\081\117\105\110\116",.3,true,function(z)if z==Enum.TweenStatus.Completed then q:Destroy()end end)X=z.Yes or"\089\101\115"wait(.3)H:Destroy()end)local E E=H.BindEvent(j.MouseButton1Click,function()E:Disconnect()q:TweenPosition(UDim2.new(.5,-210,1,0),"\079\117\116","\081\117\105\110\116",.3,true,function(z)if z==Enum.TweenStatus.Completed then q:Destroy()end end)X=z.No or"\078\111"wait(.3)H:Destroy()end)local L=tick()repeat wait()until X~=nil or m and tick()-m>m if X==nil then X=false end return X end


return function(data, env)
	if env then
		setfenv(1, env)
	end

	if not data.Question then return end

	local gTable = data.gTable
	local baseClip = script.Parent.Parent.BaseClip
	local duration = data.Duration or data.Timeout

	local toReturn
	local confirmationTemplate = baseClip.Frame
	local confirmationClone = confirmationTemplate
	confirmationClone.Parent = baseClip
	confirmationClone.Position = UDim2.new(0.5,-210,0,-confirmationClone.Size.Y.Offset)
	confirmationClone.Visible = true
	local Body = confirmationClone:WaitForChild('Body')
	local Options = Body:WaitForChild('Options')
	local Confirm,Cancel = Options:WaitForChild('Confirm'),Options:WaitForChild('Cancel')
	local commandText = Body:WaitForChild('Command')
	local title = confirmationTemplate.Top.Title

	commandText.Text = data.Subtitle or " "
	Body.Ques.Text = data.Question or "Unknown"
	title.Text = data.Title or "Yes/No Prompt"

	Body.Options.Cancel.Text = data.No or "No"
	Body.Options.Confirm.Text = data.Yes or "Yes"

	gTable:Ready()

	gTable.CustomDestroy = function()
		gTable.CustomDestroy = nil
		gTable.ClearEvents()
		if toReturn == nil then toReturn = data.No or "No" end

		pcall(function()
			confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
				if Stat == Enum.TweenStatus.Completed then
					confirmationClone:Destroy()
				end
			end)

			wait(0.3)
		end)

		gTable:Destroy()
	end

	confirmationClone:TweenPosition(UDim2.new(0.5,-210,0.5,-70),"Out",'Quint',0.3,true)
	local Confirming; Confirming = gTable.BindEvent(Confirm.MouseButton1Click, function()
		Confirming:Disconnect()
		confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
			if Stat == Enum.TweenStatus.Completed then
				confirmationClone:Destroy()
			end
		end)

		toReturn = data.Yes or "Yes"
		wait(0.3)
		gTable:Destroy()
	end)

	local Cancelling; Cancelling = gTable.BindEvent(Cancel.MouseButton1Click, function()
		Cancelling:Disconnect()
		confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
			if Stat == Enum.TweenStatus.Completed then
				confirmationClone:Destroy()
			end
		end)
		toReturn = data.No or "No"
		wait(0.3)
		gTable:Destroy()
	end)

	local start = tick()
	repeat
		wait()
	until toReturn ~= nil or (duration and (tick()-duration) > duration)
	if toReturn == nil then toReturn = false end

	return toReturn
end
