local X=(require(script.Parent.loader)).load(script)local I=X("\066\097\115\101\079\098\106\101\099\116")local d=X("\080\101\110\099\105\108\067\111\110\115\116\097\110\116\115")local T=X("\065\116\116\114\105\098\117\116\101\086\097\108\117\101")local Q=setmetatable({},I)Q.ClassName="\080\101\110\099\105\108"Q.__index=Q function Q.new(X,v)local D=setmetatable(I.new(X),Q)D._serviceBag=assert(v,"\078\111 \115\101\114\118\105\099\101\066\097\103")D._remoteEvent=Instance.new("\082\101\109\111\116\101\069\118\101\110\116")D._remoteEvent.Name=d.REMOTE_EVENT_NAME D._remoteEvent.Archivable=false D._remoteEvent.Parent=D._obj D._maid:GiveTask(D._remoteEvent)D._isDrawing=T.new(D._obj,d.IS_DRAWING_ATTRIBUTE,false)D._color=T.new(D._obj,d.COLOR_ATTRIBUTE,d.DEFAULT_COLOR)D._maid:GiveTask(D._remoteEvent.OnServerEvent:Connect(function(...)D:_handleServerEvent(...)end))return D end function Q._handleServerEvent(Q,X,I,T)if I==d.REQUEST_SET_IS_DRAWING then assert(type(T)=="\098\111\111\108\101\097\110","\066\097\100 \105\115\068\114\097\119\105\110\103")Q._isDrawing.Value=T else error("\066\097\100 \114\101\113\117\101\115\116")end end return Q
--[=[
	@class Pencil
]=]

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

local BaseObject = require("BaseObject")
local PencilConstants = require("PencilConstants")
local AttributeValue = require("AttributeValue")

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

function Pencil.new(obj, serviceBag)
	local self = setmetatable(BaseObject.new(obj), Pencil)

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

	self._remoteEvent = Instance.new("RemoteEvent")
	self._remoteEvent.Name = PencilConstants.REMOTE_EVENT_NAME
	self._remoteEvent.Archivable = false
	self._remoteEvent.Parent = self._obj
	self._maid:GiveTask(self._remoteEvent)

	self._isDrawing = AttributeValue.new(self._obj, PencilConstants.IS_DRAWING_ATTRIBUTE, false)
	self._color = AttributeValue.new(self._obj, PencilConstants.COLOR_ATTRIBUTE, PencilConstants.DEFAULT_COLOR)

	self._maid:GiveTask(self._remoteEvent.OnServerEvent:Connect(function(...)
		self:_handleServerEvent(...)
	end))

	return self
end

function Pencil:_handleServerEvent(_player, request, isDrawing)
	if request == PencilConstants.REQUEST_SET_IS_DRAWING then
		assert(type(isDrawing) == "boolean", "Bad isDrawing")
		self._isDrawing.Value = isDrawing
	else
		error("Bad request")
	end
end

return Pencil