I am making a drag tool for filtering enabled, but i can't pass rays or instances (the part that i want to move) through a remote event. I managed to decompile the rays in to the six numbers, but i still cant grab the part.
before i separated the client and server, the grabber worked fine on solo mode, so the problem is with the remote events.
Here is my local script
function onMouseDown(mouse) if true then --ill change this to test for grab-able blocks later mouse.Icon ="rbxasset://textures\\GrabRotateCursor.png" part = mouse.Target local hitPoint = mouse.Hit:toObjectSpace(part.CFrame).p local instances = {part} script.Parent.Script.StartDrag:FireServer(part, hitPoint, instances) end end
This is my Script
script.StartDrag.OnServerEvent:connect(function(mousePart, hitPoint, collection) if true then local part=mousePart dragger = Instance.new("Dragger") dragger:MouseDown(mousePart, hitPoint, collection)--This is line 8 where the error is from pcall(function() end) end end)
My error is
11:30:14.336 - Unable to cast value to Objects
11:30:14.337 - Script 'Players.Player1.Backpack.Drag.Script', Line 8
11:30:14.337 - Stack End
My question is how do i pass instance based variables like part IDs through remote events.
script.StartDrag.OnServerEvent:connect(function(Player, Args) if true then local mousePart = Args['mousePart']; local hitPoint = Args['hitPoint']; local collection = Args['collection']; print(mousePart, hitPoint); local part = mousePart local dragger = Instance.new("Dragger") dragger:MouseDown(mousePart, hitPoint, collection) pcall(function() end) end end)
function onMouseDown(mouse) if true then mouse.Icon = "rbxasset://textures\\GrabRotateCursor.png" local part = mouse.Target local hitPoint = mouse.Hit:toObjectSpace(part.CFrame).p local instances = {part} local Args = {['mousePart'] = part, ['hitPoint'] = hitPoint, ['collection'] = instances}; game:GetService("ReplicatedStorage").StartDrag:FireServer(Args) end end