local X=(require(script.Parent.loader)).load(script)local I=game:GetService("\067\111\110\116\101\120\116\065\099\116\105\111\110\083\101\114\118\105\099\101")local d=game:GetService("\072\116\116\112\083\101\114\118\105\099\101")local T=X("\066\097\115\101\079\098\106\101\099\116")local Q=setmetatable({},T)Q.ClassName="\080\101\110\099\105\108\067\111\110\116\114\111\108"Q.__index=Q function Q.new(X,v)local D=setmetatable(T.new(),Q)D._serviceBag=assert(X,"\078\111 \115\101\114\118\105\099\101\066\097\103")D._pencilClient=assert(v,"\078\111 \112\101\110\099\105\108\067\108\105\101\110\116")D._key="\080\101\110\099\105\108\095"..d:GenerateGUID(false)I:BindAction(D._key,function(X,I,d)if I==Enum.UserInputState.Begin then D._pencilClient:RequestStartDrawing()elseif I==Enum.UserInputState.End then D._pencilClient:RequestStopDrawing()end end,false,Enum.KeyCode.ButtonR2,Enum.KeyCode.E)D._maid:GiveTask(function()I:UnbindAction(D._key)D._pencilClient:RequestStopDrawing()end)return D end return Q
--[=[
	@class PencilControl
]=]

local require = require(script.Parent.loader).load(script)

local ContextActionService = game:GetService("ContextActionService")
local HttpService = game:GetService("HttpService")

local BaseObject = require("BaseObject")

local PencilControl = setmetatable({}, BaseObject)
PencilControl.ClassName = "PencilControl"
PencilControl.__index = PencilControl

function PencilControl.new(serviceBag, pencilClient)
	local self = setmetatable(BaseObject.new(), PencilControl)

	self._serviceBag = assert(serviceBag, "No serviceBag")
	self._pencilClient = assert(pencilClient, "No pencilClient")

	self._key = "Pencil_" .. HttpService:GenerateGUID(false)

	ContextActionService:BindAction(self._key, function(_, userInputState, _inputObject)
		if userInputState == Enum.UserInputState.Begin then
			self._pencilClient:RequestStartDrawing()
		elseif userInputState == Enum.UserInputState.End then
			self._pencilClient:RequestStopDrawing()
		end
	end, false, Enum.KeyCode.ButtonR2, Enum.KeyCode.E)

	self._maid:GiveTask(function()
		ContextActionService:UnbindAction(self._key)
		self._pencilClient:RequestStopDrawing()
	end)

	return self
end

return PencilControl