Why doesnt my object dragging script function correctly? [closed]
03 | local function GetBaseParts(obj) |
04 | if obj:IsDescendantOf(moveable) then |
05 | for i,v in pairs (obj.Parent:GetChildren()) do |
06 | if v = = obj.Parent then |
09 | if i = = #obj.Parent:GetChildren() and v ~ = obj.Parent then |
11 | for x,d in pairs (obj.Parent:GetChildren()) do |
12 | if d:IsA( "BasePart" ) then |
13 | table.insert(Table, d) |
22 | mouse.Button 1 Down:connect( function () |
24 | if mouse.Target:IsDescendantOf(moveable) and TargetVal ~ = nil and (TargetVal.Owner.Value = = nil or TargetVal.Owner.Value = = player.Name or TargetVal.Owner.Value = = "" ) and (player.Character.UpperTorso.Position-mouse.Target.Position).magnitude < = Settings.MaxReachDistance then |
26 | SavedTarget = TargetVal |
27 | game.ReplicatedStorage.Remotes.SetObjectOwner:FireServer(TargetVal) |
28 | dragger = Instance.new( "Dragger" ) |
29 | local hitPoint = mouse.Hit:toObjectSpace(mouse.Target.CFrame).p |
30 | local instances = GetBaseParts(mouse.Target) |
31 | dragger:MouseDown(mouse.Target, hitPoint, instances) |
There is no output errors (when i removed the pcalls, too) and the object doesnt move at all, any idea on how to fix this?