local plr = game.Players.LocalPlayer
repeat wait() until plr and plr.Character
local mouse = plr:GetMouse()
local mtarget
local down
local UTplr

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        UTplr = Character:WaitForChild("HumanoidRootPart")
    print(UTplr.CFrame)
    end)
end)

function normOBJ (v) return v / v.Magnitude end


mouse.Button1Down:connect(function()
 if mouse.Target ~= nil and mouse.Target.Locked == false and mouse.Target.Name == "CinderBlock" or mouse.Target.Name == "SodaCan" then
  print(mouse.Target.Name)
  mtarget = mouse.Target
  down = true
  mouse.TargetFilter = mtarget or mouse.Target
  end
end)



mouse.Move:Connect(function()
 if down == true and mtarget ~= nil then
	
local mvector = UTplr.CFrame.VectorToObjectSpace(mouse.Hit.LookVector)
if  mvector > 3 then
    mtarget.Position = UTplr.CFrame(normOBJ(mvector) * 3)
else
    mtarget.Position = UTplr.CFrame.VectorToWorldSpace(mvector)
end
 
 end

end)


mouse.Button1Up:connect(function()
 down = false
 mouse.TargetFilter = nil
 mtarget = nil
end)

That is the script, it allows me to pick up objects but it wont work because HumaniodRootPart is a nil value. I don't understand, may I have some help?

1 comment

0

R15 or R6?