diff --git a/lib/Client/VRDrawingController/init.lua b/lib/Client/VRDrawingController/init.lua index 562d145..e78ba86 100644 --- a/lib/Client/VRDrawingController/init.lua +++ b/lib/Client/VRDrawingController/init.lua @@ -16,6 +16,8 @@ local FreeHand = require(root.DrawingTask.FreeHand) local t = (require)(root.Parent.t) local Config = require(root.Config) +local Remotes = script.Parent.Parent.Remotes + local DEBUG = false local NEARBY_BOARD_RADIUS = 50 @@ -399,16 +401,8 @@ return { if VRService.VREnabled then - local penToolTemplate = ReplicatedStorage:FindFirstChild("Chalk") - assert(t.instanceOf("Tool", { - Handle = t.instanceOf("MeshPart", { - Attachment = t.instanceOf("Attachment") - }) - })(penToolTemplate)) - - local penTool: Tool = penToolTemplate:Clone() - penTool.CanBeDropped = false - penTool.Parent = Players.LocalPlayer:WaitForChild("Backpack") + Remotes.RequestVRChalk:FireServer() + local penTool = Players.LocalPlayer:WaitForChild("Backpack"):WaitForChild("Chalk") ControllerMaid._watchPen = watchPen(penTool) diff --git a/lib/Remotes.model.json b/lib/Remotes.model.json index ca001c7..79aac8a 100644 --- a/lib/Remotes.model.json +++ b/lib/Remotes.model.json @@ -4,6 +4,10 @@ { "Name": "RequestBoardInit", "ClassName": "RemoteEvent" + }, + { + "Name": "RequestVRChalk", + "ClassName": "RemoteEvent" } ] } \ No newline at end of file diff --git a/lib/Server/init.lua b/lib/Server/init.lua index e67afdd..11fe88f 100644 --- a/lib/Server/init.lua +++ b/lib/Server/init.lua @@ -14,6 +14,7 @@ local Remotes = root.Remotes local Config = require(root.Config) local DataStoreService = Config.Persistence.DataStoreService local BoardServer = require(script.BoardServer) +local t = require(script.Parent.Parent.t) local Maid = require(script.Parent.Util.Maid) local Persistence = require(root.Persistence) local Binder = require(root.Util.Binder) @@ -72,6 +73,19 @@ function Server:Start() end end) + Remotes.RequestVRChalk.OnServerEvent:Connect(function(player: Player) + local penToolTemplate = ReplicatedStorage:FindFirstChild("Chalk") + assert(t.instanceOf("Tool", { + Handle = t.instanceOf("MeshPart", { + Attachment = t.instanceOf("Attachment") + }) + })(penToolTemplate)) + + local penTool: Tool = penToolTemplate:Clone() + penTool.CanBeDropped = false + penTool.Parent = player:WaitForChild("Backpack") + end) + self.BoardServerBinder:Start() end